News for hackers. Stuff that matters.
Re:Why Does Julia Work So Well? by improbable22 on Wednesday October 21, 2020 @07:53AM (#24846885)
It's not so pretty, but what are the alternatives? Making indentation meaningful has downsides (copy-pasting can go very wrong) and using up ascii characters just for this means they can't do other things (like Vector{Int} type parameters) and still often takes up a line.

You can avoid it quite a bit, e.g. f(x,y) = (z=x+y; sqrt(z)) defines a function, with two statements separated by ;.

Re:Why Does Julia Work So Well? by amelius on Wednesday October 21, 2020 @08:40AM (#24847200)
I think the C/C++ convention with curly braces is ok, and doesn't make the parser much more complicated. Any closing brace has an obvious matching opening brace. And the meaning of any opening brace can be easily deduced from context, I suppose.
Re:Why Does Julia Work So Well? by ddragon on Wednesday October 21, 2020 @09:10AM (#24847486)
While I like do...end for symmetry, most of the time the end will have the same indentation as whatever opened it, and everything in between will be one indentation ahead (especially if you're using an automatic formatter), so I can follow easily without reading the content. And whatever opened it will also explicitly tell the context (if it's a method definition, if/else, for...).

In the end my code ends up like python but with an extra end, which, while adding a possibly unnecessary line of code it at least makes it trivial to copy and paste something into the repl (or other part of the code) without worrying about indentation.

Re:Why Does Julia Work So Well? by improbable22 on Wednesday October 21, 2020 @09:03AM (#24847418)
Other things are OK too. I quite like that if/elseif/else/end only needs one closing, no other openings.

I don't know whether using {} for both types & blocks would be hard to parse, maybe it's possible. I have heard & can believe that parsing <> as a 4th ascii bracket is pretty tricky.

Re:Why Does Julia Work So Well? by amelius on Wednesday October 21, 2020 @11:18AM (#24848658)
I have heard & can believe that parsing <> as a 4th ascii bracket is pretty tricky.

That's probably because < can appear without >, e.g. in a<b.

Re:Why Does Julia Work So Well? by dklend122 on Wednesday October 21, 2020 @08:56AM (#24847339)
Personally, I much prefer end to braces.

They have the benefit also of being usable for indexing and array expressions

Re:Why Does Julia Work So Well? by IshKebab on Wednesday October 21, 2020 @08:04AM (#24846948)
Julia uses `end` because it is derived from MATLAB which also uses `end`, it's not to save ASCII characters.
Re:Why Does Julia Work So Well? by cdsousa on Wednesday October 21, 2020 @09:41AM (#24847769)
AFAIK it is the opposite of what you have said. And although Julia has a lot of inspiration of Matlab syntax, it is absolutely not derived from it. https://julialang.org/blog/2012/02/why-we-created-julia/
Re:Why Does Julia Work So Well? by StefanKarpinski on Wednesday October 21, 2020 @03:23PM (#24851104)
There are many fine languages that have used `end` to delimit blocks, including: Pascal — an elegant, classic language (and my first, personally); Ruby — another gem (get it). And yes, also Matlab, which is hardly unique in this respect.
Re:Why Does Julia Work So Well? by IshKebab on Thursday October 22, 2020 @03:49AM (#24855791)
Right, but Julia is not derived from Ruby or Pascal.
Re:Why Does Julia Work So Well? by StefanKarpinski on Thursday October 22, 2020 @12:24PM (#24859772)
Julia isn't derived from Matlab either and was influenced as much by Ruby as by Matlab.
Re:Why Does Julia Work So Well? by IshKebab on Thursday October 22, 2020 @03:48AM (#24855788)
> derive: base a concept on an extension or modification of (another concept).

Obviously I didn't mean the implementation was based on MATLAB because that would be impossible.

Re:Why Does Julia Work So Well? by DennisP on Wednesday October 21, 2020 @10:56AM (#24848474)
Then why does MATLAB do it?