Ivan Porto Carrero
2009-Jan-29 21:43 UTC
[Ironruby-core] question on some code from ironrubymvc
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090129/b9dd6f50/attachment.html>
Andrew Peters
2009-Jan-29 22:06 UTC
[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 at 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 > Twitter: http://twitter.com/casualjim > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090129/bc901206/attachment.html>
Tomas Matousek
2009-Jan-29 23:32 UTC
[Ironruby-core] question on some code from ironrubymvc
_ and __ are just normal local variables (parameters) scoped to the lambda.
Tomas
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Andrew Peters
Sent: Thursday, January 29, 2009 2:06 PM
To: ironruby-core at 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 at
flanders.co.nz<mailto:ivan at 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
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20090129/d88f2c46/attachment-0001.html>