Why Ruby?

Adam D. Ruppe destructionator at gmail.com
Sun Dec 12 08:24:02 PST 2010


We already have a D block syntax!

=====

void myfun(void delegate() lol) {
        lol();
}

void main() {
        myfun = {
                assert(0, "lol");
        };
}

======

Totally compiles. :-P

It works with delegate arguments too!

========

void myfun(void delegate(string) lol) {
        lol("say it ");
}

void main() {
        myfun = (string what) {
                assert(0, what ~ " lol");
        };
}
==========

Whoa.



(note that while I'm only a little serious here - that actually
looks fine to me - I don't think the language needs a change
here. }); doesn't bother me one bit.)


More information about the Digitalmars-d mailing list