Jump to content

Introducing Julia/Migrating From Other Languages

From Wikibooks, open books for an open world

A good general resource is the Noteworthy Differences from Other Languages page from the Julia Manual.

It's also possible to call from Python, R, MATLAB, Rust, JavaScript, Java (and e.g. Scala and Kotlin) and more languages by using libraries such as PyCall.jl or jlrs (a package to call Julia from Rust, and in the other direction), rather than to possibly rewriting working code, and migrate fully that way.

It is possible to call C, without needing any package, using the ccall keyword, but there are also extra packages to help with calling C. Packages to call other language, such as to C++ (or those mentioned above), indirectly use the C-calling mechanism.

MATLAB

[edit | edit source]

Python

[edit | edit source]

To call Python, PyCall.jl has historically been used (probably the first package to call any language), but a new package PythonCall.jl is also an option providing bidirectional calling, and easy handling of Python dependencies (which are not tracked by PyCall and the user must set up manually). See comparison. PyCall strictly only supports calling to Julia, but there's a Python package (actually built on it), pyjulia, that supports calling in the other direction, in case Python is your main language.

It is possible to migrate from PyCall to PythonCall (or use both at once), while the API isn't exactly the same, might not be considered worth it, in all cases. If you choose PythonCall (e.g. for new projects), it's also possible to use it with PyCall (e.g. if some of your dependencies, such as PyPlot.jl, rely on PyCall).

  • [to come]