www.digitalmars.com         C & C++   DMDScript  

D - Re: template instantiation (suggestion)

reply Heretic <Heretic_member pathlink.com> writes:
quote
{
i don't want to keep it explicit with a keyword or token.
oh, and i want to get rid of templates that are like namespaces. eighter we get
namespaces, and can add template parameters to it, or no namespaces at all.
namespaces or not, i want templates for functions, and for classes.
instance Swap(int).call(a,b); is just plain stupid..
instance(int) swap(a,b); would be nice, for example..but
swap(a,b); is still unbeatable....
}

quote
{
The instance() form of instantiation is a nuisance that I never 
understood the need for. Is it just because the are no unambiguous 
parantheses "left"? I'm sure we can find some unused token to replace 
the <>! If you use templates a lot then all this "instance" stuff 
becomes starts getting on your nerves quickly. And it doesn't exactly 
make the code more readable either...
}

return true;

Doesnt this seem like the D standard is kinda oriented towards easy compiler
generation and fast compilation ? It isn`t always a good thing... dont get me
wrong, i have never coded a compiler so i dont know how hard it is to code this
stuff... but this template instantiation syntax pisses me off :/
Dec 01 2003
parent reply Andy Friesen <andy ikagames.com> writes:
Heretic wrote:
 Doesnt this seem like the D standard is kinda oriented towards easy compiler
 generation and fast compilation ? It isn`t always a good thing... dont get me
 wrong, i have never coded a compiler so i dont know how hard it is to code this
 stuff... but this template instantiation syntax pisses me off :/

I'm all for making a few tradeoffs for the sake of compiler simplicity, but I think good, convenient generic programming support is one of those things that's worth suffering a few contortions for. -- andy
Dec 02 2003
parent reply Berin Loritsch <bloritsch d-haven.org> writes:
Andy Friesen wrote:

 Heretic wrote:
 
 Doesnt this seem like the D standard is kinda oriented towards easy 
 compiler
 generation and fast compilation ? It isn`t always a good thing... dont 
 get me
 wrong, i have never coded a compiler so i dont know how hard it is to 
 code this
 stuff... but this template instantiation syntax pisses me off :/

I'm all for making a few tradeoffs for the sake of compiler simplicity, but I think good, convenient generic programming support is one of those things that's worth suffering a few contortions for. -- andy

Hmm. I would expect to do: list<int> intList = new list<int>; or even list<list<int>> listOfIntLists = new list<list<int>>; Granted, I might (for my own convenience sake) do a typedef for these types: typedef list<int> intlist; typedef list<intlist> intcartesian; But I would expect those types of decisions to be my perogative as a developer. Is there regexp support in D? It might simplify checking for certain types of matches.
Dec 02 2003
parent "Walter" <walter digitalmars.com> writes:
"Berin Loritsch" <bloritsch d-haven.org> wrote in message
news:bqielr$29c4$1 digitaldaemon.com...
 Is there regexp support in D?  It might simplify checking for certain
 types of matches.

import std.regexp; at your service!
Dec 19 2003