DEV Community

loading...

Discussion on: Reverted Ruby 2.7 new feature: Method reference operator

Collapse
tomlord profile image
Tom Lord

I don't like this syntax, at all.

It shaves off a few characters, but massively damages readability.

How is a new developer to make sense of this syntax? One thing ruby is really good at is "reading like English"; but this syntax appears more optimised for code golf than for human understanding.

Collapse
hanachin profile image
Seiei Miyagi Author

In other programming languages, they have more convenient way to reference the method.

gist.github.com/americodls/20981b2...
bugs.ruby-lang.org/issues/13581

IMO, the difference between Ruby and other languages is method calling.
Other languages can reference the method by .method_name without (), but ruby can't because Ruby doesn't need () for method call.

The .: looks like method calling ., with additional : can reference the method. That makes sense to me.