top | item 47178643

(no title)

muragekibicho | 2 days ago

My PhD advisor demanded I use Julia for my dissertation. Back then I was a junior programmer so Julia's one-based indexing absolutely threw me off.

In retrospect, the PhD experience was miserable and using Julia contributed to my 'death by a thousand cuts'.

discuss

order

gozzoo|2 days ago

I have tried Julia few times and each time this is what stops me. I don't understand why they decided to make indexes R-like oposed to "all other languages"-like. My brain just stops working when i need to recalculate indexes and each time I'm wrong.

Some people may not realize it, but when it comes to programming languages, ergonomics matter—a lot.

Tarq0n|2 days ago

That's just you being unable to let go of your biases? In languages with pointers giving primacy to offsets makes sense. In every other context aligning with natural language and math (first, second, 1..n inclusive) is perfectly logical.

leephillips|2 days ago

“All other languages” such as Fortran, etc.?

Why are you recalculating indices?

I don’t think that any Julia program I’ve ever written would need to change if Julia adopted 0-based tomorrow. You don’t typically write C-style loops in Julia; you use array functions and operators, and if you need to iterate you write `for i in array ...`.

“ergonomics matter”

Definitely. Ergonomics is the main reason I enjoy Julia. Performance is a bonus.

wolvesechoes|2 days ago

And 1-based indices are much more natural and ergonomic to everyone that doesn't pretend to be a machine. When I think about n-th element of a vector, its offset is not the first thing I am interested in.

Certhas|2 days ago

We had this discussion on here recently. It's really puzzling to me. Julia has the most ergonomic array interface I have worked with by far. How did 1 based indexing ever trip you up?

pjmlp|2 days ago

Outside curly languages there are plenty of 1 based to chose from, or that have the flexibility to chose the actual range.

kelipso|2 days ago

I used Julia for my dissertation too! I actually had the opposite experience where I don’t think I could have done it without Julia. Was implementing lots of niche graph algorithms. Of course, I prefer one-based indexing lol.