4 ms·
Am I the only one with hopes of Julia actually evolving into a general purpose programming language? With almost C++ level performance and homoiconicity it see
by nnq 14y ago
Am I the only one with hopes of Julia actually evolving into a general purpose programming language?
With almost C++ level performance and homoiconicity it seems really sweet and I'd love to see it used instead of Go. Though 1-indexed arrays are definitely annoying as fuck...
- KenoFischer 14y agoWell, if you're feeling really sadistic baremodule MyWay ref(x::AbstractArray, i::Int) = Base.ref(x,i+1) ref(args...) = Base.ref(args...) end is not that far away (I'm oversimplifying a little, but not much). However, please don't do this as it breaks coherence within the community. I found 1-based indexes annoying at first, but have grown quite fond of them since.
- nnq 14y agoyeah, having mixed 1-indexes and 0-indexes code would be 10x worse than just getting used to 1-based, so hope people don't do that :)
- snogglethorpe 14y ago1-based arrays are one of the more lambasted traits of Lua (an otherwise supremely elegant language), and as a long-time C/C++ programmer, I personally find 0-based arrays very natural. However what I've found from doing lots of Lua programming, is that I just don't notice very much in practice. To some degree, at least, I guess this reflects that one writes different sorts of code in different programming languages. The sort of offset-based address calculations one might do a lot in C just don't seem to happen very much in Lua. So while my natural inclination is to dislike 1-based arrays, I no longer consider them an automatic demerit....
- davidw 14y agoErlang has 1-based lists as well.
- davidw 14y agoI'm not sure who downvoted this, but: > lists:nth(1, [a, b, c]). a > lists:nth(0, [a, b, c]). ** exception error: no function clause matching lists:nth(0,[a,b,c]) (lists.erl, line 117)
- klibertp 14y agoIt's worse in Erlang: "Mainly, Regex and Binary indexes are zero-based, List and Tuple are one-based." I don't remember now but one of the collections in stdlib is zero-based too. It's much worse to be inconsistent than to choose 0 or 1-based indexes for everything.
- davidw 14y ago> one of the collections in stdlib is zero-based too. Yep, array: http://www.erlang.org/doc/man/array.html http://www.erlang.org/doc/man/array.html It's definitely a mess.