News for hackers. Stuff that matters.
Re:Julia 1.0 by ur-whale on Thursday August 09, 2018 @10:50AM (#17724662)
It most certainly is for the vast number of folks who code in C, C++, Java, Python, etc ...

It will for sure hurt adoption.

Re:Julia 1.0 by BeetleB on Thursday August 09, 2018 @11:40AM (#17725124)
>It will for sure hurt adoption.

Reminds me of the complaints my friends had about Linux when I first showed them a fantastic window manager.

"This will never get anywhere. It has no Start button."

If I were in a team that refused a language just because it is 1 based indexing, I would really worry about the abilities of the team.

Re:Julia 1.0 by weatherlight on Thursday August 09, 2018 @11:11AM (#17724831)
I'm pretty sure if people are willing to adopt a new language, they will be open minded enough to accept 1 indexed arrays.
Re:Julia 1.0 by ur-whale on Thursday August 09, 2018 @11:59AM (#17725330)
History has shown the exact opposite.
Re:Julia 1.0 by DandyDev on Thursday August 09, 2018 @12:23PM (#17725588)
Examples?
Re:Julia 1.0 by ur-whale on Thursday August 09, 2018 @01:06PM (#17726078)
You just have to look at the most popular programming languages on 2018.

They're all 0-based (with maybe R as an exception, but R is a niche language. If that's what Julia aims to remain -- their loss).

The folks who designed these languages knew how not to alienate their future market.

Re:Julia 1.0 by cultus on Thursday August 09, 2018 @01:39PM (#17726469)
Matlab is 1-based. That's what the vast majority of scientific programmmers still use. Worrying about 0 vs 1 is just useless bikeshedding, really. I've done lots of index heavy operations in Julia and in Python, and it's easy either way.
Re:Julia 1.0 by typon on Thursday August 09, 2018 @02:25PM (#17726976)
I think majority of scientific programmers use Python/C/Numpy stack over Matlab
Re:Julia 1.0 by cultus on Thursday August 09, 2018 @05:24PM (#17728639)
No, not true at all. Engineering and academia are still solidly Matlab. You have to keep in mind that these people are not programmers, they are used to Matlab, and they don't want to learn another language. It's just a small proportion of new faculty and some grad students that use Python. Statistics is all R.
Re:Julia 1.0 by goatlover on Thursday August 09, 2018 @11:21AM (#17724931)
It's not any harder to get used to than using whitespace for blocks in Python, or having to end every damn statement with a semicolon in the C inspired languages.
Re:Julia 1.0 by ur-whale on Thursday August 09, 2018 @12:08PM (#17725434)
>It's not any harder to get used to than using whitespace for blocks in Python, or having to end every damn statement with a semicolon in the C inspired languages.

Strongly disagree.

I can move from C to Python without a second thought and rewrite code from one to the other without even thinking.

Having to rewrite an algorithm working on multidimensional arrays that was written with 0-based conventions to 1-based conventions and have the resulting code remain readable is a freaking headache.

Re:Julia 1.0 by SolarNet on Thursday August 09, 2018 @12:52PM (#17725928)
Ok, then use the built in Julia features to use any offset you want inside your algorithm's code.

Compilers are pretty good about optimizing integer constants.

Re:Julia 1.0 by ur-whale on Thursday August 09, 2018 @01:04PM (#17726047)
Everyone in this thread seems to believe that 1-based indices is a non-problem because Julia "offers a choice".

My reaction:

   - the default is 1-based, which means the bulk of Julia code will adopt the convention and therefore the vast majority of coders in 2018 will have to do mental gymnastics to understand what the code does.

   - when I read Julia code, I will never know which convention the code was written with unless I dig to find where that particular flag is set.

   - passing 0-based arrays to a library routine that expects 1-based stuff, what happens then?

   - for code that will be 0-based and uses library code that expects 1-based (assuming that's possible without paying copying overhead) will force the code to mentally switch between the two modes. Ugh.

In short: offering is a choice is maybe even worse than enforcing 1-based.
Re:Julia 1.0 by SolarNet on Saturday August 11, 2018 @08:54PM (#17742351)
I think you misunderstand that the offset is encoded in the type of the object, so only your 1st concern is valid.

For concern 2, it's as easy as finding the type. And without knowing the types you wouldn't know what the code did anyway.

For concern 3, a type error.

And for 4, because it's a type there is zero runtime overhead. A view of the array with the offset the code expects is constructed, often automatically based on the types involved. This view is often a zero cost abstraction at runtime because of how Julia specialization works. So at worst you pay some (extremely minor) compile-time/load-time costs.

Re:Julia 1.0 by int_19h on Thursday August 09, 2018 @05:56PM (#17728916)
Languages that have offered that choice have been around for decades - Pascal, for example. It was never a problem in practice.
Re:Julia 1.0 by pjmlp on Thursday August 09, 2018 @11:24AM (#17724965)
Some of those folks started when Fortran, Basic, Clipper, Pascal, Modula-2, Ada were relevant.

1 based indexes were just fine.

Re:Julia 1.0 by kazinator on Thursday August 09, 2018 @04:05PM (#17727990)
Vectors are zero based in Common Lisp; the 1960 Lisp 1 manual describes arrays; they are zero based.

Zero based is much more sane. If the array is regarded as being made up of larger groups of elements, say groups of 8, then ⌊index/8⌋ gives us the group and group x 8 gives us the base element of group. Not so if index is one-based.

Zero based multi-dimensional coordinates are easy to convert to a flat address. E.g. 3D case: just ABz + By + x.

Imagine distances were one based (so that either 1 m or 1 km means no displacement), and then trying to convert a given distance between m and km. Yikes!

Music intervals are one-based, to their great detriment. We end up with a "rule of nine" for interval inversion and that comes from the octave of the diatonic scale having seven notes!

One-based indexing is okay when the indices don't have a strong numeric meaning (beyond basic successor/predecessor relationships), or none at all (basically are symbolic and could be replaced by any set that can be enumerated by the natural numbers).

As soon as the index domain is involved in displacement calculations that feature multiplication and division, anything but zero based is disadvantaged.

Re:Julia 1.0 by pjmlp on Thursday August 09, 2018 @05:49PM (#17728845)
I also have read Dijkstra, it doesn't mean I agree with everything he wrote.

In Algol based languages indexes are customizable, I don't remember ever writing array [0..9] of Integer instead of array [1..10] of Integer.

C, C++ and their descendants took over and I just had to adapt.

Re:Julia 1.0 by stellalo on Thursday August 09, 2018 @06:57PM (#17729264)
I haven’t, so far, encountered a single occasion in which I would need to manually flatten-deflatten indices: Julia has multidimensional arrays of any dimension N, and you can access their content in a linear fashion without any effort (simply provide one index instead of N)
Re:Julia 1.0 by kazinator on Thursday August 09, 2018 @10:22PM (#17730229)
Still, the implementation has to internally do ABC(z - 1) + AB(y - 1) + A(x - 1), compensating for the pointless bias at every dimension.

It's just a wanton complication, like insisting on Roman numerals instead of a radix enumeration.

Re:Julia 1.0 by stellalo on Friday August 10, 2018 @05:21AM (#17731810)
Well, I’d say the analogy with Arabic vs Roman numerals is a bit of a stretch. Seriously, it is just a matter of shifting by one, humanity has much bigger problems to focus on!
Re:Julia 1.0 by pjmlp on Friday August 10, 2018 @01:13AM (#17730853)
The implementation already has to do lots of internal stuff to map high level language abstractions to actual real hardware capabilities, index calculations is just another one.
Re:Julia 1.0 by stellalo on Thursday August 09, 2018 @03:53PM (#17727888)
I love C and I was myself suspicious when I first tried Julia. I ended up being perfectly able to reason in terms of 1-based indices and right-inclusive ranges. I’m sure I’m no special kid :-)
Re:Julia 1.0 by dnautics on Thursday August 09, 2018 @12:51PM (#17725914)
I started using elixir/erlang, which basically doesn't have indexing, ever. It's been a joy.