Parameterized Keywords

NX via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 7 08:29:27 PST 2016


On Monday, 7 March 2016 at 05:56:54 UTC, Patience wrote:
> Just curious if anyone can see the use for them?

I believe 'new' keyword can take advantage of this quite good.
For example you can pass memory usage strategy like so:
MyClass mc = new[stream] MyClass();
MyClass mc2 = new[static] MyClass();

Deja-vu? Yes the idea comes from OpenGL. Also it might come in 
handy for other stuff:
MyClass mc3 = new[no_internal_pointers] MyClass();
MyClass mc4 = new[no_compacting] MyClass();


More information about the Digitalmars-d mailing list