Complexity of Julia, comparison based on # keywords (from Quora)


#1

I ran across this, and found it a rather interesting comparison of major languages (and it even included Julia!):

How Complex Is Swift

What do other people feel about the general complexity of Julia compared to other languages?
(IMO, although a good deal more complex syntactically than Scheme or even C, I find it refreshingly simple, I can keep the things I need to know as far as syntax in my head, unlike with C++ (fear of having to go back to C++ is one of the reasons I’m so driven to be able to continue programming in Julia :grinning:! )


#2

I think Julia is quite friendly to Matlab and Fortran users. I use Julia as a free Matlab and a modern Fortan.


#3

I think especially the really great work going in to 1.0: standard libraries, more consistent and consolidated interfaces, etc. is finally making julia live up to its potential as something that could compete w python in terms of interface design.


#4

IMO “syntax complexity” is a red herring, and measuring it with reserved words is not really meaningful anyway.

Languages don’t have “complexity”, code does. The complexity of code is an emergent property of how people end up using the language, and has much more to do with semantics than syntax.

For example, multiple dispatch allows clean organization of certain code patterns, decreasing complexity. It shows up in Julia’s syntax, but that’s only accidental, you can do it with S-expressions à la CLOS.

But these measures of complexity are extremely hard to quantify objectively.


#5

Does that mean you’d prefer a free Matlab over Julia then? Just curious. I certainly wouldn’t.


#6

I wasn’t saying that I agreed with their metric, I just thought that it was an interesting datapoint, to start a discussion about what makes a language more or less complex (and if/how can Julia be made less complex)

I do think that syntactic complexity is a factor in how easy to learn a new language, and things like a large number of keywords to remember, lots of different precedence levels, or the exceptions added because of supporting a feature like multiplication by juxtaposition, all increase that complexity.

I do feel that languages have complexity, not just code - the semantic complexity of a language I feel is related to how consistent or inconsistent it’s features are, and whether things tend to be generic and composable or not (and that extends to its standard libraries).

For example, the old array literals I felt added complexity to Julia, because of inconsistencies, but thankfully, a lot of that has been cleaned up.


#7

I’d guess the main notion of complexity for me would be “principle of least astonishment”, or predictability.

That is: A language is simple if it behaves the same way as the “obvious naive way” of compiling it; all differences need to be kept in mind by the programmer. In this sense, C is complicated (depending on version) and C++ is obscenely complicated and needs a degree in language-lawyering; asm is very simple; python appears less complex than julia; numba is not even a language, you throw code at the wall, see what comes out and pray that this will be reproducable (maybe I’m just bad at numba); javascript is pretty complicated.

Not sure whether I can make a judgement regarding julia yet; it kinda feels like one needs to read a lot of Base code and possibly deeper internals to understand what happens (but then, I prefer reading julia code to ISO-exegesis any day).


#8

For me, the only advantage of Matlab is their customer service, if I email them normally I can get my answer in one business day. However, I can get my question solved in less than one day in Julia discourse. In addition, I can build Julia with MKL and call Fortran easily. But I do hope Julia can have a reliable and high-performance graphics tool box.


#9

I think the situation is much better than people often make it seem, but the honest truth is that many of the issues are only standing due to lack of man hours, so feel free to lend a hand :wink:


#10

One of the reasons I think Julia is a very good teaching (and learning) language is because you can ask for its intermediate steps: parse to lower to code_lowered to code_typed to code_llvm to code_native.

These tools have a learning curve, but you can tackle them incrementally. Once you have a handle on them, it’s entirely possible to figure out why something surprised you.

The list of reserved words he used for that Quora answer was really old — we’re down to 31 reserved words or so these days… and three more are deprecated and slated to be removed by 1.0.


#11

Yes - that’s a very good point. I use them all the time, when trying to figure out surprises when doing benchmarking. (The only thing I’d like more is a recursive form of them, that would show, to some number of levels deep, the methods called by the top level method)