Project

General

Profile

Feature #13581

Syntax sugar for method reference

Added by americodls (Americo Duarte) over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:81282]

Description

Some another programming languages (even Java, in version 8) has a cool way to refer a method as a reference.

I wrote some examples here: https://gist.github.com/americodls/20981b2864d166eee8d231904303f24b

I miss this thing in ruby.

I would thinking if is possible some like this:

roots = [1, 4, 9].map &Math.method(:sqrt)

Could be like this:

roots = [1, 4, 9].map Math->method

What do you guys thinking about it?


Related issues

Related to Ruby master - Feature #16275: Revert `.:` syntaxClosedActions
Is duplicate of Ruby master - Feature #12125: Proposal: Shorthand operator for Object#methodClosedActions

Also available in: Atom PDF