Delegate Literals + Immutability, pure and closures

dsimcha dsimcha at yahoo.com
Thu Sep 29 14:03:26 PDT 2011


== Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article
> Note that there is a workaround for 1:
> DT noclosure(DT)(scope DT d) if(is(DT == delegate))
> {
>    return d;
> }

I know, but this defeats the nice zero-boilerplate solution to getting type
inference and immutability when you want to conditionally assign one of several
values to a variable.

> Also note that next to memory allocation, lack of inlining is the biggest
> performance problem.  It's not negligible (in case that is what you were
> saying, hard to tell from all the negatives ;)

Clarification:  I didn't mean lack of inlining is negligible in general, only for
this use case.  If you have a bunch of complicated conditions and whatnot in the
function body then the extra 5 clock cycles or so for a function call probably
don't mean much


More information about the Digitalmars-d mailing list