Actions
Feature #15741
closedOrdinal parameters
Description
Numbered parameters have been introduced into trunk, and are still being hotly debated in #15723.
One of the problems of the feature is, too short, too symbolic, and then too cryptic. It resembles Perl.
I counterpropose "ordinal parameters":
$ ./miniruby -e '
[ [1, 1, 1], [2, 2, 2], [3, 3, 3] ].each { p 0th * 1st * 2rd }
'
1
8
27
Ordinal parameters are much better than numbered parameters in two points:
- It is English. No symbol is used. It looks nicer, doesn't it?
- Some people are complaining that
@1
is one-based. Instead, my proposal is zero-based: it starts with0th
.
In other words, it no longer resembles the notorious $1
at all.
You may wonder if it is too friendly for English speakers. Don't worry, it is carefully designed:
- It is tolerant of small errors. In fact, "2rd" (not "2nd") is allowed. This is because I often typo.
- Even "1th", "2th", and "3th" are allowed. Non-English-native programmers don't have to learn the difference among "st", "nd", "rd", and "th".
A patch is attached.
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0