Issue #15741 has been updated by sawa (Tsuyoshi Sawada).


shevegen (Robert A. Heiler) wrote:
> Check the date sawa. :)

I see. Honestly, I have never felt this kind of stuff to be funny.

----------------------------------------
Feature #15741: Ordinal parameters
https://bugs.ruby-lang.org/issues/15741#change-77416

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: Next Major
----------------------------------------
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 with `0th`.

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--------------------------------
ordinal-parameters.patch (1.62 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>