Please test: black holes and white holes

Shin Fujishiro rsinfu at gmail.com
Tue May 19 01:38:55 PDT 2009


Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>
> The code looks very clean and well-written. Great job.
> 
> One question - has anything prevented you from writing a shell class?
> 
> class BlackHole(C)
> {
>      mixin(generateBlackHoleCode(C.stringof));
> }
> 
> ?
> 
> It's a tad more comfortable to just say BlackHole!C instead of 
> generating it separately.
> 

At first I wrote BlackHole as a template class. But I was biten by this:
--------------------
module test
interface X {}
interface C { X foo(); }
--------------------
BlackHole!C could not tell what the X is because BlackHole and X are
defined in different modules. -> "Error: identifier 'X' is not defined"

Now it came to my mind that the problem could be solved by inserting
"alias ReturnType!(C.foo) X;" in generated code. I'll try this.


More information about the Digitalmars-d-announce mailing list