Hacker News new | ask | show | jobs
by m3mpp 2851 days ago
What is the language lineage? Is it functional or imperative? Dynamic or statically typed? Garbage collected or not? I wish every introduction to a new language would contain that kind of info, it'd be so much more informative.

Edit: missed one, natively compiled or VM based.

4 comments

Julia is an attempt at the best of all worlds:

- It is functional (including lisp-like macro programming) but has a strict type system along with multiple dispatch, which effectively allows for OOP constructs.

- It allows for dynamic typing but since it is JIT compiled using LLVM, you can specify static types for variables and thus take advantage of lots of smart optimisation.

- There is garbage collection but also the ability to get right in there and reach into pointers and memory-allocation manually.

It's truly a pleasure to work with once you appreciate what's possible.

There are no reliability or uptime guarantees though. I wouldn't write a serious Web framework in it (though people have certainly tried)
I’ll have a stab at answering this, someone who knows better can correct me.

Dynamic with optional typing. General consensus is that it has a pretty great type system. Union types, language level implementation of high performance missing types. Garbage collected. JIT compiled using LLVM backend; entire language is written in itself, so the compiler doesn’t have any “black boxes”, I.e. it can optimise everything. Great multiple dispatch system. Imperative technically I guess? But feels like it’s lifted a bunch of good ideas from various functional and domain specific languages.

Anything I missed?

It's strongly typed. At the code level, it's dynamic, but you can strictly type your functions. For the types of workloads julia is best at (computational, batch) if you get a type error panic mid-computation, you've done something wrong, and it should be rare.

JIT is better described as "extremely lazy ahead of time compilation" (not my words). Except for globally-scoped commands, e.g. REPL (I think?) code is always going to be compiled before it is run.

Some examples of fantastic things I've done with julia:

1) wrote a drop-in replacement to IEEE floating point and evaluated numerical performance in operations like FFT, linear algebra, machine learning... I only had to write the basic operations + - * /, and a few algebraic functions like one(T). Everything else (matrix mult, linear solving, complex numbers) came for free.

2) wrote a Galois field type and ran experiments on Reed-Solomon erasure coding. Didn't have to rewrite the linear solver \ function. The builtin one worked just fine - well, in version 0.5 I had to patch it, but it worked great in 0.6 and beyond.

3) wrote a DSL that would "write verilog for me". I could pass an integer type and validate easily that the wires had the result I expected, then use the multiple dispatch on a "semantic type" which was a wrapper on String, which literally generated verilog instead of doing operations on numbers. Then I used verilator (an open source verilog -> C transpiler) to dynamically generate the verilog into a .so file, upload it back to julia, and then run full set of unit tests against both. This suite took me a week to write.

User defined types are __no__ different than "native" types.

You are talking to the llvm compiler, sure you are talking in Julia most of the time, but if you happen to want to talk in C or FORTRAN or ASM in the middle of your high level script, just do. No marshalling of I/O or data structure impedance it all compiles the same.

Exactly. Typing choices are a key part of what makes Julia interesting. And user types are first-class.
So can I define custom operations in llvm ir?
You can write custom code in llvm IR.[0] I must leave it to you to tell me if you can use it as an operator. My guess is yes, but I will not be getting to play any time soon.

[0]https://docs.julialang.org/en/stable/base/c/#Core.Intrinsics...

Actually, aside from the llvm back end, the parser is in lisp. Not really a black box though.

Though I guess you are talking about libraries?

Yes, I've read it breifly, it's a good description but I always prefer human feedback, with languages, the devil is in the details :)
Looks very interesting, any known drawback, maturity, package available, anything?
Drawbacks:

* A lot of packages are incompatible with the latest versions of Julia. Though because it has stabilized, this is likely to stop being an issue soon.

* There isn’t any major organization that has adopted it yet, which may impact its long term success in contrast to other new languages like go swift rust etc that have a major sponsor. Garbage collector makes it unsuitable for certain real time uses, which is unfortunate given its otherwise predictable performance characteristics.

* Although there are web frameworks for it, I’m not sure whether they are mature enough for production use.

* Personal pet peeve: no infix operator for integer division. I haven’t looked recently whether there is a package for this. I should probably make my own if not.

> * Personal pet peeve: no infix operator for integer division.

Sure there is

    julia> 10 ÷ 3
    3
type as

``` 10 \div<tab> 3 ```

in any decent julia-capable environment (REPL, editors, notebooks, etc)

Oh wow. I see it was just missing from the docs until May, which was why I hadn't seen it.
The FAA is collaborating with Lincoln Labs to develop a new collision avoidance system using Julia¹. I don't know if that's the kind of thing you had in mind, but it's being used by many companies and universities on various projects, and is the language vehicle in a lot of courses on numerical analysis and related topics.

¹https://juliacomputing.com/case-studies/lincoln-labs.html

Well, I was thinking more of an organization using it across the board, preferably one that is prominent enough to result in other copycat users.

(To be clear, I really love the Julia language, and use it quite a bit in personal projects - I'm just hoping that it gets strong adoption, since adoption is what drives the development of miscellaneous libraries and packages).

The federal reserve bank has adopted it (for stress testing models? IIRC), I'd say that's pretty major.
They may have additional projects, but I believe you’re talking about https://github.com/FRBNY-DSGE/DSGE.jl .
The transition to v1.0 for packages is taking some time. The core language is so extensible and allows performant packages such that much of what people expect to be core (an FFT) is in an external package which has not yet been updated for 1.0.