6 ms·
I like D solution very much: http://dlang.org/phobos/std_typecons.html#.Flag http://dlang.org/phobos/std_typecons.html#.Flag which results in calls like: d
by lultimouomo 12y ago
I like D solution very much: http://dlang.org/phobos/std_typecons.html#.Flag http://dlang.org/phobos/std_typecons.html#.Flag which results in calls like:
document.addObserver(observer, "load", Yes.isWeak);
or
xhr.OpenUrl(url, options, No.sync)
- btzll 12y agoWow that looks really good. Can you use any String after the dot? P.S. I don't use D
- barrkel 12y agoYou could look at the linked documentation. I think it makes it clear. PS: I don't use D.
- barrkel 12y agoI see the lazy people are out in force :)
- lultimouomo 12y agoYes, you declare the parameter as Flag!"async" And then the possible values are Yes.async and No.async This exploits D dispatch operator: http://dlang.org/operatoroverloading.html#dispatch http://dlang.org/operatoroverloading.html#dispatch which in general is great for implementing this sort of dynamic feature in a strongly statically typed language as D - everything is checked as compile time!