Project

General

Profile

Actions

Feature #18460

closed

implicit self for .() syntax without rvalue

Added by cvss (Kirill Vechera) almost 3 years ago. Updated almost 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:106973]

Description

We have a nice .() shorthand for calling Proc

m = 1.method(:+)
m.(2) # 3

But while we can use this shorthand in a Proc's context with the explicit self, we cannot use it with the implicit self:

m.instance_exec { self.(2) } # 3
m.instance_exec { .(2) } # syntax error, unexpected '.' (SyntaxError)

So I propose to make this syntax valid too.

Updated by matz (Yukihiro Matsumoto) almost 3 years ago

  • Status changed from Open to Rejected

This proposal is rejected for several reasons:

  • we don't allow .m notation for implicit self (for now at least)
  • You will gain only 4 fewer characters
  • I don't think it's worth the cost of syntax complexity it brings

Matz.

Actions

Also available in: Atom PDF

Like0
Like0