3 ms·
I feel that the array starting index should be adjustable at runtime via increment/decrement overloading for either the [ or ] character. var var meanings = [4
by pledess 3y ago
I feel that the array starting index should be adjustable at runtime via increment/decrement overloading for either the [ or ] character.
var var meanings = [42]!
print(meanings[-1])! //42
[++! //temporarily change to 0-based indexing
print(meanings[0])! //42
print(meanings[-1--])! //42 (because of the --] pre-decrement)
- ravi-delia 3y agoMight be worth opening a pull request! Lots of people might prefer starting at something more intuitive, like -0 or NaN
- al2o3cr 3y agoDoes it even count as an esolang feature if it was a real feature in a commonly-used language for years? https://perldoc.perl.org/5.20.0/arybase https://perldoc.perl.org/5.20.0/arybase It was even more fun in Perl 4, when $[ was program-scoped o_O