Delegate Literals + Immutability, pure and closures

Timon Gehr timon.gehr at gmx.ch
Sat Oct 1 05:54:46 PDT 2011


On 09/30/2011 08:06 AM, Don wrote:
> On 30.09.2011 02:32, dsimcha wrote:
>> On 9/29/2011 5:06 PM, David Nadlinger wrote:
>>> Yes, this pattern is very useful indeed, I also often use a similar
>>> solution for generating code for string mixins on the fly. Do we already
>>> have a name for it, by the way? I like to call it »IEDL for »Immediately
>>> Executed/Evaluated Delegate Literal«, but that's probably just me.
>>
>> No previously chosen name that I know of, but I like your name. Anyhow,
>> I'm impressed/pleasantly surprised. I didn't realize an IEDL could be
>> executed at compile time to produce a mixin string. If IEDLs are that
>> universally useful, then they definitely deserve some special case
>> performance optimizations, i.e. inlining and avoiding heap allocations.
>> Does anyone else have any interesting use cases for them?
>
> I use them everywhere in the test suite. They behave a lot like comma
> expressions (in that they allow you to put multiple expressions in a
> place where you'd normally only be able to have one) but they allow
> statements and declarations as well as expressions. This makes them
> extremely useful in metaprogramming.

They will be if they are inlined. How about not only allow the compiler 
to inline the immediately executed delegate literals, but to even 
_enforce_ that every single one of them is inlined?


More information about the Digitalmars-d mailing list