Forum: IronRuby question on some code from ironrubymvc

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-01-29 22:57
(Received via mailing list)
Hi
While working on the code for a ironrubymvc i came across the following
code

controllerRubyClass.EnumerateMethods((_, symbolId, __) =>
                                                         {
                                                             if
(String.Equals(symbolId, actionName,

  StringComparison.OrdinalIgnoreCase))
                                                             {

controllerRubyMethodName = symbolId;
                                                                 return
true;
                                                             }
                                                             return
false;
                                                         });

The tidbit I find interesting is the _ and the __ in the lambda. Is that
an
equivalent for null or does it something else?
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
GSM: +32.486.787.582
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
0e5987d3f0456799c5327d5ae47b72e1?d=identicon&s=25 Andrew Peters (andrewpeters)
on 2009-01-29 23:09
(Received via mailing list)
Cool! I didn't know you could do this.

It's just a placeholder when you don't care about that arg. Very
functional.
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-01-30 00:33
(Received via mailing list)
_ and __ are just normal local variables (parameters) scoped to the
lambda.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Andrew Peters
Sent: Thursday, January 29, 2009 2:06 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] question on some code from ironrubymvc

Cool! I didn't know you could do this.

It's just a placeholder when you don't care about that arg. Very
functional.
On Thu, Jan 29, 2009 at 1:43 PM, Ivan Porto Carrero
<ivan@flanders.co.nz<mailto:ivan@flanders.co.nz>> wrote:
Hi

While working on the code for a ironrubymvc i came across the following
code

controllerRubyClass.EnumerateMethods((_, symbolId, __) =>
                                                         {
                                                             if
(String.Equals(symbolId, actionName,
                                                                               StringComparison.OrdinalIgnoreCase))
                                                             {
                                                                 controllerRubyMethodName
= symbolId;
                                                                 return
true;
                                                             }
                                                             return
false;
                                                         });

The tidbit I find interesting is the _ and the __ in the lambda. Is that
an equivalent for null or does it something else?
---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
GSM: +32.486.787.582
Blog: http://flanders.co.nz<http://flanders.co.nz/>
Twitter: http://twitter.com/casualjim
This topic is locked and can not be replied to.