Hacker News new | ask | show | jobs
by tomkaos 1393 days ago
Worst than 0 and 1 is to have the choice. In Visual Basic 6 you have the option between the base 0 or 1 for each module. It make debugging a nightmare and you can create bug just by copy/pasting code from one program to other with a different base index.
2 comments

You also have the choice in Perl, because of course, it is Perl.

The old way of doing it was setting the $[ variable to 1. You can actually set it to any value, in case you prefer to start your arrays at 42. It is now deprecated but you now have Array::Base that offers similar functionality.

Use it if you absolutely hate the person who will read your code, as if having someone read Perl code wasn't hateful enough.

One of the least-loved APL features is the fact that you can change the index origin at runtime.