Make alias parameter optional?
Ali Çehreli
acehreli at yahoo.com
Sun Feb 26 02:03:12 PST 2012
On 02/25/2012 05:04 PM, Robert Rouse wrote:
> On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote:
>> On 2/25/12 7:31 PM, Robert Rouse wrote:
...
>>> This means that D can simulate Ruby blocks more than I thought. That's
>>> pretty awesome. I'm loving D more every day.
>>
>> How's that like a Ruby block?
>
> The D code simulates the following Ruby if you were to make bar print
> "something" with writeln.
>
> def foo(a, b, &block)
> puts "a is #{a}")
> b.call
> yield
> end
>
> f = lambda { puts "good bye" }
>
> foo(1, f) { puts "something" }
>
>
> That's what I'm talking about.
>
I don't know Ruby but from what I've read so far about Ruby blocks,
their D equivalents may also be D ranges.
Ali
More information about the Digitalmars-d-learn
mailing list