References on how to embed python classes/functions in C++ using BoostPython - boost-python

May I know, if I can refer to some good website references/links that show how I can embed/wrap python classes and functions(methods) in C++(not the other way around). I found how to wrap from C++ to python(like here), but what I'm interested in, is the other way around.

You can call C++ from Python. The tutorial you pointed out contains an introduction to that. Look for the section "Functions - Overloading". It shows how you can create bindings to allow your C++ call pythonic functions. The approach can also be applied to classes.

Related

VS Code / IDEs: How can I enable cmd+click goto definition for variables declared at runtime?

I'm looking to improve my own productivity by trying to figure out how to provide cmd+click functionality for variables declared at runtime. I work with a library that allows you to register objects to it at runtime to be accessed later — it would be great if I could cmd+click to definitions of these! How do you think I could achieve this? I'm open to any ideas. Thanks!
Edit:
Thoughts I have so far inspired by feedback from various Slack communities:
There is no such thing as 'runtime' when providing functionality in IDEs
We need to be able to teach the IDE about what definitions to expect. Whether this means writing an extension to use the VS Code API specifically for my use-case, or otherwise working within a system that generates files that the IDE already knows to look for, which allows it to connect the dots and provide the precious peek / goto definition functionality
Edit:
I'm starting work on a VS Code extension that reads a dotfile for configuration — I'll share what I find out as I go!

Variable, Class, function etc. inspector for Atom

For visual studio code, there exists some addon/plugin which shows you the origin for example of an included class, the return value of a function etc..
I find it very handy, but I want this functionality in atom since I prefer atom.
How does one call this kind of plugin/addon, so I can look for it on google?
And ideally, what addon/plugin supports this feature best.
If I understood you correctly, the functionality name is IntelliSense.
About IntelliSense used in VS code, you can read here.
Actually you must do your research depending on programming language you use. I.e. if you're using js you must search javascript Intellisense atom and find it in first link

How would a closed-source (i.e. precompiled) Swift library work without headers?

In C, C++ and Objective-C you can compile part of an executable into its own "object file" and use it (and/or a library containing multiple object files) from any other code by including a "header file". Highly-templatized C++ code notwithstanding, a "header" typically contains just the declarations needed to validate the correctness of calling code (and assist the IDE with autocomplete, etc.).
But Swift does not have header files.
Now, apparently it is not currently possible to make a Swift static library, but in the future how would a situation like the above work, wanting to use some existing precompiled code from "new" source code, given that Swift does not have headers?
Would it work something like how [I infer] Java must work, where the compiled form can be introspected enough for the compiler to verify it is being used properly? Does Bitcode in addition to its intermediate representation also provide the necessary "protocol" for retaining such metadata?
If Apple were to port Cocoa to Swift (and keep it closed source), how would it then be "imported" into Swift apps?
Although, really, this question is not anything to do with "closed source" per se but rather trying to understand the boundaries around compilation units in Swift. Based on a similar question for the Go language, mine here could be re-phrased as: can you link to a pre-compiled Swift library without the source?
Well, just consider Apple's Swift libraries. They are closed-source, and you can use them fine and you can see pseudo-"headers" for the stuff in the library in the compiler. The exact mechanism of how this works is not currently publicly documented, but it must exist.
In addition to #user102008, the good new is, Swift will be open sourced by the end of this year, and even ported to Linux by Apple. While we can't guarantee it will always work that way (as Apple has poor records on those kind of issues), people will found suitable solutions within this even if Apple has no interests in doing so.
Even more, afaik, Swift objects were actually Objective-C objects. There'll not be that different to make Swift things work than Objective-C. (More details: http://www.eswick.com/2014/06/inside-swift/) After they were compiled, just do a class dump (or load it into a debugger such as IDA) and you can easily create a .h to make it work like normal static library or a framework.

How to run additional statements in eclipse(pdt for PHP)?

Like firebug's console,I can type in the scripts directly.
Is there a similar place in eclipse out there?
Or do I install some plugin to have the feature?
You can use the Display window to type in code snippets, set variable values and evaluate whilst debugging.
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/views/display/ref-display_view.htm
The "watch" view can be used to execute simple snippets of code.
In some circumstances, I use the groovy shell (in a separate window) to check how a code snippet will behave. It isn't practical when complex data structures or library classes are involved, but for a respectable number of cases it works very well.
You can use the Expression and Display views. There's a set of excellent free video tutorials on the Eclipse debugger that you can see here. The aforementioned views are talked about in lesson 3.

Writing Emacs extensions in languages other than Lisp

I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml.
Does anybody know of a way to write Emacs extensions in a language other than Lisp? This could either take the form of bindings to the Emacs extension API in some other language (e.g., making OCaml a first-class Emacs extension language) or an Emacs interaction mode where, for example, the extension has a pipe into which it can write Emacs Lisp expressions and read out result values.
http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage is a list of all non-Elisp extension languages you can use.
It does appear to be dynamic language centric.
http://common-lisp.net/project/slime/ is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge. Its source code would show how to communicate back and forth over sockets.
A similar IDE for Erlang is Distel, at http://fresh.homeunix.net/~luke/distel/ (currently down) and https://github.com/massemanet/distel.
Good luck!
I don't know if this will work for your particular problem, but I have been doing something similar using the shell-command-to-string function:
(shell-command-to-string
"bash -c \"script-to-exec args\"")
So for example, we have existing scripts written in python which will mangle a file, so the above lets me invoke the script via emacs lisp.
A quick google search found this page describing a system to write extensions in Python, so it seems feasible to do what you want... you will just have to see if anyone has written a similar framework for OCaml.
Some Extension Api is now possible with the incoming emacs 25.1 and dynamic modules
A Library, emacs-ffi offer a foreign function interface based on libffi.
Check out complete documentation on the README.
Try PyMacs, which allows extending Emacs in Python.
edit: updated link.
From the statically typed languages side, there is something that looks quite performant and well featured for Haskell:
https://github.com/knupfer/haskell-emacs
there is also probably something useful for Scala to be reused from the Ensime project (has a bridge for both Emacs and Vim):
https://github.com/ensime/ensime-server
Furthermore, a quick google search revealed another potential candidate for extending Emacs with a classic FP language, OCaml; the project has a lot of .ml source files so there's got to be an Emacs-OCaml bridge somewhere:
https://github.com/the-lambda-church/merlin
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving.
You can run Emacs commands from your other process. Have a look at Gnuserv.
There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a simpler example, maybe sql-postgresql?