On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:
On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga
wrote:
[2] https://epi.github.io/2017/03/18/less_fun.html
BTW in your D foreach, you could also have done `switch`
void trigger(string event) {
switch(event) {
foreach (i, e; events) {
case e:
foreach (c; callbacks_[i])
c();
return;
}
default:
assert(false, "trying to trigger an unknown event: "
~ event);
}
}
And the compiler+runtime can optimize that into a binary search
when it gets larger automatically.
Doesn't the latest compiler complain with a depreciation that i/e
initialization is being skipped?