Re:Giving up on Julia
by KenoFischer on Friday May 13, 2016 @03:55PM
(#11692823)
This syntax is available in julia as well, but I'm not sure it's a great idea to encourage mixing the two indexing behaviors, even if they have different syntax. As I hinted
in the original reply, I have seen very few cases where the
choice of index offset actually makes a difference. For
example, loops over indices generally use `eachindex` which doesn't care about your choice of index base.
[ Parent
| on HN ]
Re:Giving up on Julia
by ScottPJones on Saturday May 14, 2016 @04:22AM
(#11695093)
Actually, for the sort of low-level bit twiddling code that I frequently do, 1-based indexing complicates the code greatly.
I also need to pass structures that contain indices back and forth to C, so the 1-based indices cause extra overhead to constantly add or subtract the size of the element. I find that it's the largest cause of bugs in my code (which is why I really want Gallium working!)
That's interesting - thanks. I don't think anyone is eager to mix indexing behaviors either.
Re:Giving up on Julia
by KenoFischer on Friday May 13, 2016 @04:11PM
(#11692913)
I just realized that when I said, "this syntax is available", people might have understood it to mean, "you can use this syntax to index arrays" (which is not true for the array type defined in base). What I meant was, "you can define an array type with this indexing behavior without changing the language (since you can override the behavior of both () and [] on a particular type)".