ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120747] [Ruby master Feature#21082] Alias it to its
@ 2025-01-21 14:46 northeastprince (Matt Almeida) via ruby-core
  2025-01-21 23:26 ` [ruby-core:120755] " duerst via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: northeastprince (Matt Almeida) via ruby-core @ 2025-01-21 14:46 UTC (permalink / raw)
  To: ruby-core; +Cc: northeastprince (Matt Almeida)

Issue #21082 has been reported by northeastprince (Matt Almeida).

----------------------------------------
Feature #21082: Alias it to its
https://bugs.ruby-lang.org/issues/21082

* Author: northeastprince (Matt Almeida)
* Status: Open
----------------------------------------
One of Ruby's core tenants is beautiful code - and a key part of that is sweating 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120755] [Ruby master Feature#21082] Alias it to its
  2025-01-21 14:46 [ruby-core:120747] [Ruby master Feature#21082] Alias it to its northeastprince (Matt Almeida) via ruby-core
@ 2025-01-21 23:26 ` duerst via ruby-core
  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
  2 siblings, 0 replies; 4+ messages in thread
From: duerst via ruby-core @ 2025-01-21 23:26 UTC (permalink / raw)
  To: ruby-core; +Cc: duerst

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120756] [Ruby master Feature#21082] Alias it to its
  2025-01-21 14:46 [ruby-core:120747] [Ruby master Feature#21082] Alias it to its northeastprince (Matt Almeida) via ruby-core
  2025-01-21 23:26 ` [ruby-core:120755] " duerst via ruby-core
@ 2025-01-22  0:13 ` northeastprince (Matt Almeida) via ruby-core
  2025-01-22 11:47 ` [ruby-core:120760] " Earlopain (Earlopain _) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: northeastprince (Matt Almeida) via ruby-core @ 2025-01-22  0:13 UTC (permalink / raw)
  To: ruby-core; +Cc: northeastprince (Matt Almeida)

Issue #21082 has been updated by northeastprince (Matt Almeida).


Hey Martin! Thanks for your input.

It seems like there's a very small amount of core method names that would have such a level of linguistic dissonance based on the receiver. However, even something like `ledger.include? transaction` seems more adaptive than `it.title`, though that might just be me.

Happy to let `it` sit for a while before any changes are considered 😆.

----------------------------------------
Feature #21082: Alias it to its
https://bugs.ruby-lang.org/issues/21082#change-111618

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120760] [Ruby master Feature#21082] Alias it to its
  2025-01-21 14:46 [ruby-core:120747] [Ruby master Feature#21082] Alias it to its northeastprince (Matt Almeida) via ruby-core
  2025-01-21 23:26 ` [ruby-core:120755] " duerst via ruby-core
  2025-01-22  0:13 ` [ruby-core:120756] " northeastprince (Matt Almeida) via ruby-core
@ 2025-01-22 11:47 ` Earlopain (Earlopain _) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: Earlopain (Earlopain _) via ruby-core @ 2025-01-22 11:47 UTC (permalink / raw)
  To: ruby-core; +Cc: Earlopain (Earlopain _)

Issue #21082 has been updated by Earlopain (Earlopain _).


> Second, Ruby has up to now rejected grammatical inflections such as includes instead of include.

`File.exists?` was even removed.

Many methods could do with a alias that reads nicer in certain situations. For example, `posts.each { put its.title }` looks even better to me but where do you stop?

----------------------------------------
Feature #21082: Alias it to its
https://bugs.ruby-lang.org/issues/21082#change-111622

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-22 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-21 14:46 [ruby-core:120747] [Ruby master Feature#21082] Alias it to its northeastprince (Matt Almeida) via ruby-core
2025-01-21 23:26 ` [ruby-core:120755] " duerst via ruby-core
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

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).