Templates everywhere

Walter Bright newshound1 at digitalmars.com
Sun Mar 14 21:04:42 PDT 2010


Jason House wrote:
> Philippe Sigaud Wrote:
> 
>> Today I think in templates (well, at least I try to...). So:
>> 
>> 1- thanks Walter for opening new vistas to me. Doing templated code
>> in D is so fun and powerful that you transformed forever the way I
>> look at problems. 2- Do other have a similar evolution?
> 
> I started with a basic comfort with templates and generalizing code,
> but have taken things farther with D. I recently started ripping some
> templates out because my code was getting ugly. What I'm currently
> wishing for is templated modules...
> 
> module foo(T,U,V); class bar // Implicit (T,U,V) { }
> 
> module x; import foo!(T,U,V) bar b; // Not messier  bar!(T,U,V) b
> 
> It's a small bit of syntactic sugar, but for certain constructs, it
> can make a world of difference. I wonder if others would also want
> that.
> 


   module foo;

   template foo(T,U,V)
   {
      ... your module's declarations ...
   }

should do it.



More information about the Digitalmars-d mailing list