Re:Julia Language Co-Creators Win James H. Wilkinson Prize f...
by tzs on Wednesday January 23, 2019 @12:22PM
(#18980254)
I once had occasional to implement several of the algorithms from the second part of Knuth volume 2, in C++.
I don't recall the details, as this was a long time ago, but there were definitely times I was glad C++ used 0-based arrays, and there were definitely times when 1-based would have made for cleaner code.
So I overloaded the () operator to make a(n), where a is an array, equivalent to a[n-1].
It looked a little odd at first if I mixed a[] and a() form in the same program, but it wasn't hard to get used to.
I doubt I would recommend this in general, but it worked well for this particular application.
I don't recall the details, as this was a long time ago, but there were definitely times I was glad C++ used 0-based arrays, and there were definitely times when 1-based would have made for cleaner code.
So I overloaded the () operator to make a(n), where a is an array, equivalent to a[n-1].
It looked a little odd at first if I mixed a[] and a() form in the same program, but it wasn't hard to get used to.
I doubt I would recommend this in general, but it worked well for this particular application.