Why Ruby?
Jacob Carlborg
doob at me.com
Mon Dec 13 10:36:09 PST 2010
On 2010-12-12 19:37, Nick Sabalausky wrote:
> "Nick Sabalausky"<a at a.a> wrote in message
> news:ie34p4$dgk$1 at digitalmars.com...
>> "Adam D. Ruppe"<destructionator at gmail.com> wrote in message
>> news:ie2sv2$2thb$1 at digitalmars.com...
>>> 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.)
>>
>> I'm sure that's going to disappear when D's properties get implemented as
>> intended.
>>
>
> And FWIW, it looks like operator-overload-abuse to me.
This is operator overload abuse:
myfun in (string what) {
assert(0, what ~ " lol")
};
"myfun" would return a struct that has defined an opIn method.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list