Hacker News new | past | comments | ask | show | jobs | submit login

- One-based indexing

setting aside whether zero- or one-based indexing is 'better'; R and MATLAB have one-based indexing, so the convention is likely familiar to many in the Julia target audience.

still, as the OP says, (relatively) painless interoperability with C and C++ is an advertised Julia feature, both of which use zero-based index (although Fortran is one-based), and that mis-match is a definite obstacle to interoperability.




I find I don't pass individual array indices back and forth between C and Julia as often as I would in Python or Matlab, since I don't need as much compiled interface glue. You can do iteration and the like entirely on the Julia side or entirely on the C side and mostly pass the array buffers back and forth. ccall handles that for you if you declare a Ptr{Float64} argument type that the C library expects and send it a Julia Array{Float64} input. It's when you have arrays of indices, like the linear programming library his example snippet is referring to, that you notice. Or serializing text-based representations.


It does look like support for arbitrarily based arrays (like Fortran 90) will be available in Julia v0.5 (thanks to Tim Holy's great work). Julia is very flexible, and the next thing is to allow row-major instead of just column-major arrays (something that I've heard is also being worked on, although I don't know if it will be ready for v0.5)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: