foo!(bar) ==> foo{bar}

Michel Fortin michel.fortin at michelf.com
Tue Oct 7 19:14:24 PDT 2008


On 2008-10-07 21:13:40 -0400, "Lionello Lunesu" 
<lionello at lunesu.remove.com> said:

> I think more effort should be spent on unifying template and normal code.
> 
> Partial compilation and "auto" support in the argument list might make 
> the whole template syntax obsolete, since the compiler could issue a 
> specially compiled version for constant argument values / argument 
> types. Add to that support for "alias" template parameters in a normal 
> argument list and we're on the right track:
> 
> typeof(r1) overlap(auto r1, auto r2)
>  if (typeof(r1) == typeof(r2))//not really ok but it's what algorithm.d has now
> {
> //...
> }
> 
> typeof(rs) filter(alias pred, auto[] rs ...)
> {
> //...
> }
> 
> I suppose we'd also need a way to force compilation of specific 
> instantiations for inclusion in precompiled libraries.
> 
> Please let me know if I'm talking BS here....

I think this is great concept... "implicit template functions"! You're 
right that it cannot be included in precompiled libraries because it 
has to be instanciated once you know the type of your arguments, but 
this hasn't stopped templates from being used up to now.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list