From: maciej@...
Date: 2019-11-05T11:38:23+00:00
Subject: [ruby-core:95694] [Ruby master Feature#16275] Revert `.:` syntax

Issue #16275 has been updated by maciej.mensfeld (Maciej Mensfeld).

File Zrzut-ekranu-z-2019-11-02-17-04-12.png added

I'm also in favor of what Tim stated but at the same time, I want to point out, that the way it is now is not optimal from the performance point of view.

Ruby gives you a new instance of a `#Method` class. Even when you���re fetching the method of the same instance of an object. That���s not all. If used with the `&` operator, each of the fetched method references is later on converted into a Proc object using the `#to_proc` method. That makes the code almost 10 times slower than the "standard" one and heavily stresses out the GC. I've pointed this here already: https://bugs.ruby-lang.org/issues/16103 and here are my recent benchmarks: https://mensfeld.pl/2019/11/the-hidden-cost-of-the-ruby-2-7-dot-colon-method-reference-usage/

I would not expect the majority of Ruby programmers to know subtle details like this one (especially as those may or may not be certain Ruby implementation detail).


----------------------------------------
Feature #16275: Revert `.:` syntax
https://bugs.ruby-lang.org/issues/16275#change-82482

* Author: naruse (Yui NARUSE)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
`obj.:method` is introduced at r66667 by #12125 and #13581.
It encourages the functional programming style in Ruby.

But this shorthand syntax is just for methods of `self` without arguments.
It causes another feature requests like #16273 (and lambda compositions like #15428).

Such features will introduce a new view of Ruby but no one illustrates the whole picture yet.
I worried about such patch work may cause a conflict with future expansion of functional programing style or a just a garbage feature.

`.:` syntax is introduced in 2.7.0 preview1, not released in production yet.
How about reverting at this time and re-introduce with a big picture.

---Files--------------------------------
Zrzut-ekranu-z-2019-11-02-17-04-12.png (8.69 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>