On 2011-06-11 19:29, Andrej Mitrovic wrote: > I can't seem to find anything specific like an enhancement request. > > Here's a similar report by you: > http://d.puremagic.com/issues/show_bug.cgi?id=4971 > > Maybe we should have a 'common (newbie) mistakes' section on the > website and add this bit of information there.
It certainly sounds like a good idea. And thanks to the fact that we're switching to d-programming-language.org, and its source is up on github, it's even possible for anyone to make the changes necessary and create a pull request for it. What I'd like to see templates be able to do though is better recognize a type that _will_ work in at least a few common cases. Static arrays are one (if all of the template overloads fail, perhaps it should try instiating them with the dynamic version of the same type). Another is immutable dynamic arrays. const(T)[] would work if you declared the template with those explicit parameters, but as long as it's taking R or Range instead of const(T)[] for arrays, a range-based function won't work with immutable arrays even though it should. But that sort of change could be too big a change to how templates work. I don't know. I should probably write up an enhancement request on the subject. - Jonathan M Davis