northeastprince (Matt Almeida) wrote:
One of Ruby's core tenants is beautiful code - and a key part of that is sweating the names. Adding it
as a pointer to the first block parameter was a huge step forward in that regard, but we're not done yet. If [1, 2, 3].each { puts it }
works, posts.each { puts its.title }
should work too.
I propose we reject this. First, we have only just recently introduced it
. It (sic!) definitely makes sense to wait and get experience with it
before we add a variant.
Second, Ruby has up to now rejected grammatical inflections such as includes
instead of include
.
Third, if we accept a possessive ending, we would have to do it in general. posts.each { |post| puts post's.title }
(or some such, we'd have to figure out a solution for the apostrophe, maybe just leave it out).
Fourth, in something.title
, the period already indicates a possessive relation in many cases, in particular if the following method name is read as a noun. Adding the s
would lead to something like a double possessive ("the title of of it", so to say).
Fifth, the use of s
endings in variable names in programming languages is mostly associated with plural (element
: single element; elements
: array or hash of elements), much more so than in English, where a final 's' can indicate a third person singular in a verb, a plural in a noun, or a possessive (usually with an apostrophe). So when I first saw its
in the example, I was actually thinking about an operation on an array, despite the fact that the plural of 'it' in English is of course 'they', not 'its'.
In conclusion, let's reject this.