Hacker News new | ask | show | jobs
by lucozade 2798 days ago
> This is too often the attitude of Julia people

And it's a good attitude for the Julia people to have. Their target audience is not just (or even mainly) full time developers. They're targeting scientists, statisticians etc. As such, it makes sense for Julia to use conventions that are appropriate to their audience. This pervades the whole of Julia, not just indexing although the latter is exceptionally rich for this reason.

> Programmers just like it

That's a reason for having 0-based indexing but not an especially good one. And for Python it was an arbitrary decision. That's not to say that 0-based indexing is necessarily an arbitrary decision, it wasn't for C, for example, but it often is.

1 comments

> And it's a good attitude for the Julia people to have. Their target audience is not just (or even mainly) full time developers. They're targeting scientists, statisticians etc.

I don't see how scientists or staticians would be unable to understand a basic knowledge like zero-based indexing. In fact, zero-based indexing already is widely used in basic areas such as series and sequences. Why are freshmen quite capable of understanding such a fundamental convention but somehow seasoned scientists and statitians are not?

> I don't see how scientists or staticians would be unable to understand a basic knowledge like zero-based indexing

Of course they can. In fact, they tend to have a complex relationship with indexing which is why Julia supports such a rich indexing language.

But the default the Julia team chose was the natural, mathematical default rather than the natural memory addressing default. Which, given what they were trying to achieve, was entirely sensible.

And, on a side note, just because something is physically possible, it doesn't follow that it's the most sensible choice. Otherwise language development would have stopped at the first Turing complete language.

What the Julia team is attempting to do is make the transition for their target audience as seamless as possible. This can be seen in their indexing language but also in their choice of dispatch, their type conversion architecture etc. A great deal of thought goes into these decisions (you can see it in their issue/RFC trackers). "A CS freshman could work it out" doesn't even come close.

The truth is that everyone who programs seriously at any level can deal with both 0- and 1- based indexing. It's just not that hard to get used to.

And science has lots of 1- based indexing: Matlab, Fortran, R, most math...

I don't see how programmers wouldn't be able to understand 1 based indexing.
Do you know how much easier it is for me to look at the mathematical definition of something and transcribe it (almost) quite literally directly into Julia code because of it's 1 based indexing?

I'll tell you: it's very, very, very easy. And when a language makes things easy, people tend to like it (that's one of the reasons people like Python after all).