From: Nathan Broadbent Date: 2012-11-14T04:13:44+09:00 Subject: [ruby-core:49314] Re: [ruby-trunk - Feature #7346][Open] object(...) as syntax sugar for object.call(...) --e89a8ff25156528aac04ce65374c Content-Type: text/plain; charset=ISO-8859-1 @rosenfeld, I'll just mention that you can use Proc#[] in your example: double = -> n { n * 2 } double[3] == 6 #=> true On Wednesday, 14 November 2012, rosenfeld (Rodrigo Rosenfeld Rosas) wrote: > > Issue #7346 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). > > > Ah, of course! :D I totally forgot about Kernel#p! :P > > Yes, that makes total sense. > ---------------------------------------- > Feature #7346: object(...) as syntax sugar for object.call(...) > https://bugs.ruby-lang.org/issues/7346#change-32860 > > Author: rosenfeld (Rodrigo Rosenfeld Rosas) > Status: Rejected > Priority: Normal > Assignee: matz (Yukihiro Matsumoto) > Category: core > Target version: Next Major > > > I propose for the parser to interpret "object(...)" as "object.call(...)". > It should raise NoMethodError at runtime if object doesn't respond to > "call". > > This would read better than using "call": > > double = -> n { n * 2 } > > double(3) == 6 > > Sorry if this has already been proposed before (and rejected) but I > couldn't find any references to something like this using Redmine's search > interface. > > > -- > http://bugs.ruby-lang.org/ > > --e89a8ff25156528aac04ce65374c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable @rosenfeld, I'll just mention that you can use Proc#[] in your example:=

double =3D -> n { n * 2 }

double[3] =3D=3D 6 =A0#= =3D> true


On Wednesday, 14 November 2012, rosenfeld (Rodrigo Rosenfeld Rosas) <= span> wrote:

Issue #7346 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).


Ah, of course! :D I totally forgot about Kernel#p! :P

Yes, that makes total sense.
----------------------------------------
Feature #7346: object(...) as syntax sugar for object.call(...)
https://bugs.ruby-lang.org/issues/7346#change-32860

Author: rosenfeld (Rodrigo Rosenfeld Rosas)
Status: Rejected
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: Next Major


I propose for the parser to interpret "object(...)" as "obje= ct.call(...)". It should raise NoMethodError at runtime if object does= n't respond to "call".

This would read better than using "call":

double =3D -> n { n * 2 }

double(3) =3D=3D 6

Sorry if this has already been proposed before (and rejected) but I couldn&= #39;t find any references to something like this using Redmine's search= interface.


--
http://bugs.ruby-l= ang.org/

--e89a8ff25156528aac04ce65374c--