The Final(ize) Challenge

Christopher Wright dhasenan at
Mon May 18 17:52:29 PDT 2009

Andrei Alexandrescu wrote:
> Christopher Wright wrote:
>> Andrei Alexandrescu wrote:
>>> I think you need to operate exclusively with string mixins in 
>>> Finalize, so __ident would be of marginal help there. Also, static 
>>> foreach is much more necessary.
>> That is a huge problem.
>> Let's say that the class you want to finalize, Target, has a method 
>> like this:
>> void foo(SomeClass){}
>> Let's say that SomeClass is private and in the same module as Target.
>> You *may* be able to do this with templates. Probably.
>> You *can never* do this with a string mixin.
> Of course you can. All you have to do is first check whether the call is 
> accessible from your instantiation point, BEFORE generating the string.
> Andrei

And a lot of interesting usages will have the Finalize template 
instantiated far from user code, but then passed back to user code. This 
means you can't do much at all with string mixins.

I faced that problem with dmocks and didn't find a good solution for it 
while still working on dmocks.

More information about the Digitalmars-d mailing list