Hacker News new | ask | show | jobs
by g0wda 3874 days ago
FWIW, I work on Web-related stuff in Julia (like http://shashi.github.io/Escher.jl). I find Julia's type system more natural for general purpose modeling of data than, say, Python's classes. It's also really easy to enforce things like immutability or make stuff blazing fast if one needs to with little effort. Julia's multiple-dispatch is a great companion. On many occasions I've wondered if my code is even complete because it winds up being so small. Another thing to like is the hackability of any code. The standard-library is in Julia, you can look at any function's code from the REPL, and many more developer friendly features.

Jonathan Malmaud, Iain Dunning, Randy Zwitch, Mike Innes (OP) and many others write and maintain general purpose/web-related library code. I'm sure they will agree with some of what I said.

3 comments

Definitely agree. Obviously a lot of people come to Julia for the performance, but even without that it's just a really nice language to work with. For me the speed is a nice bonus that gives Julia a surprisingly broad range of use – from one-shot scripts to fully-fledged C++ replacement (though obviously for quite a different class of applications than, say, the ones that Rust targets).

It's interesting that people see multiple dispatch as some esoteric computer science-y thing. In reality, it's just a way of organising code and complexity, just like object orientation is – and it has some compelling advantages over OO as well. For me, it's one of the killer features that I really miss in other languages, and it's well worth taking the time to understand it.

It would be great to see people doing more web stuff in Julia, but for the foreseeable future there will be some important caveats. The web libraries (including in Base) just aren't that fleshed out or battle-tested right now, and there's no Google-scale engineering effort making sure that the runtime is reliable over thousands of CPU hours. Whoever dives into that first will have to have a clear sense of the long-term value.

Thanks for your honesty re the web stuff.

I agree multi dispatch is awesome, and python has some implementations of it as well.

http://matthewrocklin.com/blog/work/2014/02/25/Multiple-Disp...

Escher looks really interesting, and a really good match to a hypothetical project I'm planning. So does Julia --- I've done a little scientific computing, mostly in C++, but I'm mostly interested in general-purpose programming, and a quick glance over Julia's feature set makes it look really promising. (Although I'd still like a static type checker.)

If all the logic happens server-side in Escher, what's the responsiveness like? Do you have a live example anywhere?

Are there any plans to transpile Julia into Javascript?

Responsiveness is excellent when your Julia process is on the same machine as the browser - which in itself addresses a large set of use cases scientific computing audience has (such as presentations). When the Julia process is connected over the network, there is obviously a lag between updates. But it's no better or worse than an AJAX/WebSocket application. The intention is to use web components to encapsulate UI components and their behavior (including self-contained animations) and Julia to read from them and update their attributes. So one can switch to writing web components and using them in Escher if responsiveness is really a concern. With the programming model in Escher, it will be easy to hoist some computations to the browser once there is Julia to JavaScript compilation. However, I don't plan to write the transpiler (yet) ;).
So Web Components become the C of the MVC triad, with invisible RPC over the network to Escher for the MV running in Julia? I really like that idea, particularly if the RPC protocol falls back gracefully from WebSocket to long-polling to polling.

Do you know of anything using Escher for public web-facing applications yet?

> Are there any plans to transpile Julia into Javascript?

Since Julia uses LLVM IR, it should be possible to go from LLVM to Javascript using emscripten.

Yes escher is amazing thanks :)

"more natural for general purpose modeling of data than, say, Python's classes"

Can you elaborate? In most cases single dispatch does just fine. Then class = type except much slower

Not the parent, but I agree with Julia types being more natural for many purposes.

It's far easier to create new Julia types for modeling a new domain than Python classes. Genrally, types are much more succinct to declare than classes. They're also type checked and parameterized which allow you to do some rather nice things with an API design that would require a lot of if/else behavior checking in Python classes.

The separation of implementation and data declarations via multiple dispatch makes a large assortment of problems much easier to solve. For example, it's much easier to extend the built in behavior of default Julia types such as dictionaries by adding your own custom method (often on line of code) which is incredibly useful for short data processing script.

There isn't as much web focus in Julia currently, but once the implementation makes it easier to possibly "pre compile" an executable I think there could be a big boom in usage for web engines.

I'm on a mobile device currently and can't really write out more explicit details. Maybe later I can write out a lab example.