Julia (programming language): Difference between revisions

Content deleted Content added
mNo edit summary
No edit summary
Line 110:
By default, Julia is run similarly to scripting languages, using its runtime, and allows for [[read–eval–print loop|interactions]],<ref name="PackageCompiler.jl" /> but Julia programs/[[source code]] can also optionally be sent to users in one ready-to-install/run file, which can be made quickly, not needing anything preinstalled.<ref name=AppBundler.jl /> Julia programs can also be (separately) compiled to [[binary executable]]s, even allowing no-source-code distribution, and the executables can get much smaller with Julia 1.12. Such compilation is not needed for speed, though it can decrease constant-factor startup cost, since Julia is also compiled when running interactively, but it can help with hiding source code. Features of the language can be separately compiled, so Julia can be used, for example, with its runtime or without it (which allows for smaller executables and libraries but is limited in capabilities).
 
Julia programs can reuse libraries from other languages by calling them, e.g. calling [[C (programming language)|C]] or [[Rust (programming)|Rust]] libraries, and Julia (libraries) can also be called from other languages, e.g. [[Python (programming language)|Python]] and [[R (programming language)|R]], and several Julia packages have been made easily available from those languages, in the form of Python and R [[library (computing)|libraries]] for corresponding Julia packages. Calling in either direction has been implemented for many languages, not just those, and [[C++]].
 
Julia's [[Visual Studio Code]] extension provides a fully-featured [[integrated development environment]] with "built-in dynamic autocompletion, inline results, plot pane, integrated REPL, variable view, code navigation, and many other advanced language features"<ref>{{Cite web |title=Julia in Visual Studio Code |url=https://code.visualstudio.com/docs/languages/julia}}</ref> e.g. debugging is possible, [[lint (software)|linting]], and [[profiling (computer programming)|profiling]].<ref>{{Cite web|last=Holy|first=Tim|title=GitHub - timholy/ProfileView.jl: Visualization of Julia profiling data.|website=[[GitHub]]|date=2019-09-13|url=https://github.com/timholy/ProfileView.jl|access-date=2019-09-22|archive-date=31 January 2020|archive-url=https://web.archive.org/web/20200131231452/https://github.com/timholy/ProfileView.jl|url-status=live}}</ref><ref>{{Cite web|last=Gregg|first=Brendan|title=GitHub - brendangregg/FlameGraph: Stack trace visualizer.|website=[[GitHub]]|date=2019-09-20|url=https://github.com/brendangregg/FlameGraph|access-date=2019-09-22|archive-date=26 September 2019|archive-url=https://web.archive.org/web/20190926230048/https://github.com/brendangregg/FlameGraph|url-status=live}}</ref><ref>{{Cite web|url=https://julialang.org/blog/2019/03/debuggers|title=A Julia interpreter and debugger|website=julialang.org|access-date=2019-04-10}}</ref><ref>{{Cite web|url=https://timholy.github.io/Rebugger.jl/dev/|title=Home · Rebugger.jl|website=timholy.github.io|access-date=2019-04-10|archive-date=31 March 2019|archive-url=https://web.archive.org/web/20190331171846/https://timholy.github.io/Rebugger.jl/dev/|url-status=live}}</ref>
Line 201:
In Julia, everything is an object, much like object-oriented languages; however, unlike most object-oriented languages, all functions use [[multiple dispatch]] to select methods, rather than single dispatch.
 
Most programming paradigms can be implemented using Julia's [[Homoiconicityhomoiconicity|homoiconic]] macros and packages. Julia's [[Macro (computer science)#Syntactic macros|syntactic macros]] (used for [[metaprogramming]]), like Lisp macros, are more powerful than [[Macro (computer science)#Text-substitution macros|text-substitution macros]] used in the [[preprocessor]] of some other languages such as C, because they work at the level of [[abstract syntax tree]]s (ASTs). Julia's macro system is [[hygienic macro|hygienic]], but also supports deliberate capture when desired (like for [[anaphoric macro]]s) using the <code>esc</code> construct.
 
Julia draws inspiration from various dialects of Lisp, including [[Scheme (programming language)|Scheme]] and [[Common Lisp]], and it shares many features with [[Dylan (programming language)|Dylan]], also a multiple-dispatch-oriented dynamic language (which features an [[infix notation|infix]] syntax rather than a Lisp-like prefix syntax, while in Julia "everything"<ref name="Learn Julia in Y">{{Cite web |url=https://learnxinyminutes.com/docs/julia/ |title=Learn Julia in Y Minutes |website=Learnxinyminutes.com |access-date=2017-05-31 |archive-date=15 August 2018 |archive-url=https://web.archive.org/web/20180815232855/https://learnxinyminutes.com/docs/julia/ |url-status=live }}</ref> is an [[expression (computer science)|expression]]), and with [[Fortress (programming language)|Fortress]], another numerical programming language (which features multiple dispatch and a sophisticated parametric type system). While [[Common Lisp Object System]] (CLOS) adds multiple dispatch to Common Lisp, not all functions are generic functions.
Line 223:
 
===Interoperability===
Julia has built-in support for calling [[C (programming language)|C]] or [[Fortran]] language libraries using the <syntaxhighlight lang="julia" inline="">@ccall</syntaxhighlight> macro. Additional libraries allow users to workcall withto or from other languages such as [[Python (programming language)|Python]],<ref>{{Cite web |title=PythonCall & JuliaCall |date=2023-10-29 |url=https://github.com/JuliaPy/PythonCall.jl |access-date=2023-10-30 |publisher=JuliaPy |archive-date=31 October 2023 |archive-url=https://web.archive.org/web/20231031010517/https://github.com/JuliaPy/PythonCall.jl |url-status=live }}</ref> [[R (programming language)|RC++]],<ref>{{Cite web |last=Cords |first=Clem |title=RCall.jlClemapfel/jluna |date=20232024-1011-1612 |url=https://github.com/JuliaInteropClemapfel/RCall.jljluna |access-date=20232024-1011-3026}}</ref><ref>{{Cite web |publishertitle=JuliaInteropCxxWrap |archive-date=30 April 20192023-10-28 |archive-url=https://web.archive.org/web/20190430053549/https://github.com/JuliaInterop/RCallCxxWrap.jl |urlaccess-statusdate=live2023-10-30 |publisher=JuliaInterop}}</ref> [[C++Rust (programming language)|Rust]], [[R (programming language)|R]],<ref>{{Cite web |title=CxxWrapRCall.jl |date=2023-10-2816 |url=https://github.com/JuliaInterop/CxxWrapRCall.jl |access-date=2023-10-30 |publisher=JuliaInterop |archive-date=30 April 2019 |archive-url=https://web.archive.org/web/20190430053549/https://github.com/JuliaInterop/RCall.jl |url-status=live }}</ref> or to call/use [[Java (programming language)|Java]],<ref>{{Cite web |date=2020-06-02 |title=Julia and Spark, Better Together |url=https://juliacomputing.com/blog/2020/06/02/julia-spark.html |archive-url=https://web.archive.org/web/20200714205019/https://juliacomputing.com/blog/2020/06/02/julia-spark.html |archive-date=14 July 2020 |website=juliacomputing.com}}</ref> and [[SQL]].<ref>{{Cite web |last=Foster |first=Claire |title=SQLREPL.jl |date=2023-10-23 |url=https://github.com/c42f/SQLREPL.jl |access-date=2023-10-31 |archive-date=27 September 2022 |archive-url=https://web.archive.org/web/20220927085821/https://github.com/c42f/SQLREPL.jl |url-status=live }}</ref><ref>{{Cite web |last=Noh |first=WooKyoung |title=Octo.jl |date=2023-10-18 |url=https://github.com/wookay/Octo.jl |access-date=2023-10-31}}</ref><ref>{{Cite web |title=Usage Guide · FunSQL.jl |url=https://mechanicalrabbit.github.io/FunSQL.jl/stable/guide/#Why-FunSQL? |access-date=2023-10-31 |website=mechanicalrabbit.github.io |archive-date=31 October 2023 |archive-url=https://web.archive.org/web/20231031175900/https://mechanicalrabbit.github.io/FunSQL.jl/stable/guide/#Why-FunSQL? |url-status=live }}</ref><ref>{{Cite web |date=21 October 2022 |title=Using Julia with Oracle Databases |url=https://blogs.oracle.com/timesten/post/using-julia-with-oracle-database |access-date=8 November 2022 |archive-date=8 November 2022 |archive-url=https://web.archive.org/web/20221108125241/https://blogs.oracle.com/timesten/post/using-julia-with-oracle-database |url-status=live }}</ref>
 
===Separately-compiled executables option===