[nem-en] Re: Macro proposal

Elifant elifantu at mail.ru
Wed Jun 20 08:09:41 CEST 2007


Kamil Skalski пишет:
> Ah, so actually <|  would be equivalent to function application...
> So, right, this should be possible too. What macro could do here is to
> transform the right hand side from expression to lambda, so you could
> write
> 
> f (1,a) <|  3
> 
> and it would be transformed into
> 
> f (1, a, fun () { 3 })
> 
> which probably would bring us even closer to Ruby blocks ;)
> 
> f(1,a) <|   {
>   foo ()
> }

In general, lambdas will accept parameters, and IMHO it is better to use 
usual fun(a,b) { ... }
instead of trying to mimic Ruby's {|a,b| ... }.
BTW, blocks in Ruby are more than just lamdas, e.g. 'return' statement 
inside block will return from
enclosing function, not from the block. I think it is possible to 
implement blocks in Nemerle, but
their behaviour may be too suprising for anyone besides Rubyists.




More information about the devel-en mailing list