I think most IDEs, and even simpler editors, take care of some of these already. To take your examples: In VS Code, Atom, Sublime etc. <cmd+/> toggles line comment, for any language supported by the editor. You should also have a for snippet that expands on tab by just typing for. And many more.
Check out snippets in your favourite editor. Some are already there, and you can add others. I particularly like snippets in LaTeX, which is so full of boilerplate.
BTW: What’s up with the flagging of some posts in here? It doesn’t seem like anything is in violation of guidelines, right?
Different languages target different use cases so it makes sense that their syntax is not the same. Also, with fixed templates, innovation is harder and one can not improve upon mistakes made in the past, catch up to changing times etc.
I think in most places, Julia does use syntax that is also used by at least a few other languages, but maybe not each individuals favourite language.
We keep excruciatingly detailed institutional history, in the form of the git commit log and issues: https://github.com/JuliaLang/julia. There’s a lot of it, but that’s how much thought and effort has gone into the language you get. Explaining all the design decisions that have gone into Julia would take more time and energy than anyone has to spend. The manual does some of this explaining already.
@mthelm85: That operator is EXACTLY why I stopped using R. Python’s syntax was a relief, but Python is too slow. Matlab is expensive. So Julia was something I was really looking forward to…until I saw some of the syntax I had been considering posting this topic for many months, and finally did so. Glad to see that many of y’all share the same opinion.
Maybe I’m misunderstanding your conclusion there, but Julia has nicest syntax of any language I’ve seen, with only a few minor blemishes (I never liked where {T}). For example, I prefer the current syntax to the ones proposed in the OP.
Julia definitely has the nicest syntax I have ever seen; it uses my favourite keyword end to terminate blocks, so you don’t have to use curly braces, and yet don’t have to rely on the abomination that is syntactic indentation. This is in common with Ruby, another language I really like.
It uses -> to define function, which is awesome, because that is how you write functions in math (and with a font such as Fira Code or the smoking hot JuliaMono-> and other digrams are turned into ligatures that makes your code look even more like math).
Parametric functions (which is called generics in Java and templates in C++) are fantastically transparent and nice in Julia; since e.g. C++ templates are Turing complete, there is no end to how awesome/horrifying your code can get (and I actually like(d) C++). Compiler errors due to C++ templates are magnificent (in a horrible way). Julia compiler errors due to parametric types are verbose (less so in 1.5), but always logical.
(EDIT: I should note that of course, no programming language has better syntax than LISP, but that’s because LISP does not have a syntax , since you program the abstract syntax tree directly.)
Yes, that is definitely a nice feature of the arrow assignment. It clarifies the difference between equality and variable assignment. If you try to read the statement x = x + 1 as a mathematical statement, it makes no sense.
Another nice thing is that in R you can also use -> for assignment. This can be handy in a pipe:
Perhaps an unintended side effect is that mutability is not the first thing engineered into methods. Often it’s nice to have stuff be immutable. Just a reason why pop! is good syntax.
The first one. = is the assignment operator in almost every lang, while <- is very esoteric and makes me feel there might be some magic going on. Also, the readable way to write that is z = (x == y). Not following good style can make any syntax hard to read.
Now that we are on hacking Julia to type less, is there a way to call a function without () or @ (i.e., no macro call either)? A zero-arg operator kind of thing. It’s nice for impure functions that don’t need input, and don’t need to be passed around as an object themselves.
No, that’s impossible – how would Julia know to distinguish between “the function f” and “the result of calling the function f”? There has to be some indication in the syntax.