Optimizing delegates

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Dec 19 23:30:43 PST 2010


On 12/19/10 1:09 PM, Nick Sabalausky wrote:
> It's not completely useless: "int foobar(int delegate(int) f) { }" allows
> you to choose what delegate to send at run-time. "int foobar3(alias f)()
> { }" doesn't. (Although, I suppose you might be able to work around that
> moving the run-time selection from the caller of foobar3 to the delegate
> passed into "int foobar3(alias f)() { }". Not sure if there are cases where
> that would be awkward to do.)

In fact you can select the alias at runtime, which is quite a trick.

Andrei


More information about the Digitalmars-d mailing list