From: duerst via ruby-core <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: duerst <noreply@ruby-lang.org>
Subject: [ruby-core:120755] [Ruby master Feature#21082] Alias it to its
Date: Tue, 21 Jan 2025 23:26:07 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-111617.20250121232607.56392@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-21082.20250121144628.56392@ruby-lang.org>
Issue #21082 has been updated by duerst (Martin Dürst).
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.
----------------------------------------
Feature #21082: Alias it to its
https://bugs.ruby-lang.org/issues/21082#change-111617
* Author: northeastprince (Matt Almeida)
* Status: Open
----------------------------------------
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.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
next prev parent reply other threads:[~2025-01-21 23:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 14:46 [ruby-core:120747] " northeastprince (Matt Almeida) via ruby-core
2025-01-21 23:26 ` duerst via ruby-core [this message]
2025-01-22 0:13 ` [ruby-core:120756] " northeastprince (Matt Almeida) via ruby-core
2025-01-22 11:47 ` [ruby-core:120760] " Earlopain (Earlopain _) via ruby-core
2025-02-13 6:44 ` [ruby-core:120967] " matz (Yukihiro Matsumoto) via ruby-core
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-111617.20250121232607.56392@ruby-lang.org \
--to=ruby-core@ml.ruby-lang.org \
--cc=noreply@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).