top | item 47179558

(no title)

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.

discuss

order

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.