Hacker News new | ask | show | jobs
by johan_felisaz 1830 days ago
I think most of the criticisms against Julia come from the fact that people see it as a Python competitor. In its actual state (even if the last version improved compile time a bit), it is not really usable as an exact python replacement (short scripts, opening a new interpreter each time).

However it is a revolution for the HPC crowd. If your program is supposed to run for several days on multiple nodes, 10 seconds of compilation is a negligible price to pay for a much cleaner and shorter code than Fortran or C/C++.

I've been using Julia for a few months for physics related simulations and it's just so much better than Fortran to work with.

1 comments

While I definitely agree, I'd say Julia is totally fine for short scripts too. Just spin up https://github.com/dmolina/DaemonMode.jl and you can launch lots of short scripts without excessively restarting julia.

There's also PackageCompiler.jl https://github.com/JuliaLang/PackageCompiler.jl for AOT compilation, but that's heavy enough that I wouldn't bother with it for short scripts.

Of course, these packages are fantastic, they do help a lot for more experienced users. But for a pure beginner, there is a high risk he will give up Julia after 10s of Plots.jl compilation, way before we would hear about these.

(and tbh, even leaving a REPL open all the time works perfectly fine, since include("myscript.jl") really does reload the script, unlike the import keyword in Python)

Yeah, that's fair. I guess I read your comment as saying that julia isn't a good replacement for Python, rather than it takes a tiny bit of learning when you're coming from other languages.

I think the way we talk about julia sometimes makes Python and Matlab programmers think they can just take some of their old code and copy paste it into julia, switch around some keywords and have everything be faster. It's important to emphasize to these people that it's a different language with its own idioms that need to be learned.

I strongly agree with that, coming from Matlab to both Python and Julia. While I enjoy some of the similarities between Julia and Matlab, it does take some learning and effort to write proper code in another language. Array indexing with square brackets in Julia tripped me up initially for instance as Matlab uses parentheses, and it still take non-zero mental effort to adjust when writing Julia (despite having done C in a distant past...).

Writing proper and idiomatic code that gets the best out of each language takes even longer as it requires more knowledge and experience. Having spent the last ten years or so predominantly in Matlab, and the corporate environment moving increasingly to Python, and my own interest in Julia, I am getting a double dose of this.

Pragmatically I like Matlab best, in large part because I am so comfortable in my workflow and the large existing codebase, but also the IDE, debugger, etc. I most fascinated by Julia but find that exploiting its potential has its own learning curve, and wrangling with type stability has its own challenges. I am least enthused by Python, which I am learning mostly from necessity, but this may be colored by my extreme aversion to its use of indentation.

I also started in Matlab + C, and didn't personally like Python very much, but wound up liking Julia after a bit of adjustment.

Still a work in progress, but I've written up a few of my lessons learned in the process [1] in case they're useful to anyone else. Properly figuring out type stability and dispatch-oriented programming took me way too long, but things started making a lot more sense after that.

I haven't used it a ton, but [2] also seems potentially useful for anyone else interested in making the same switch.

[1] https://github.com/brenhinkeller/JuliaAdviceForMatlabProgram...

[2] https://lakras.github.io/matlab-to-julia/

Python has importlib.reload(), though I haven't found much need to use it
Indeed. Given the fast startup time of Python, I've always just restarted the session (which is most of the time faster than typing "import importlib; importlib.reload()" haha)
I really want to pick up Julia as my general purpose scripting language, but neither of those solutions meet the standard for “totally fine” imo. For reference, my current use case for Python is 95% scripting, 5% ad hoc exploratory data science.

I need a way to package and distribute scripts, so that they can run in a container for example. Running a server to execute scripts only works well for local workflows. PackageCompiler.jl has terrible ergonomics. I don’t think Julia is quite there for scripting yet, unless you’re already deeply invested into it for other reasons.