Either I'm just too stupid, or D is lacking something

Sean Kelly sean at f4.ca
Tue Jul 25 06:45:45 PDT 2006


Oskar Linde wrote:
> Oskar Linde skrev:
>> Wolfgang Draxinger skrev:
>>> Oskar Linde wrote:
>>>
>>>> It is a minor change, but would break existing code, so getting
>>>> it before 1.0 would be preferred.
>>>
>>> Could you give me an example of breakage? I don't see a reason
>>> (yet), why that would break something. I'd have said, that my
>>> suggestion is a superset of the old behaviour and backwards
>>> compatible, but seem's I was wrong.
>>
>> Currently, when a template contains several functions, they are not 
>> implicit template properties and must be called as func!().func(...). 
>> If the proposed change was introduced, they would be required to be 
>> called as func!()(...). Example:
> 
> Another proposal that I made before in conjunction with the above is to 
> make implicit template properties explicit via the /this/ keyword. It 
> would work analogous to how /this/ is used to denote class constructors.
> 
> template myfunc(T) {
>     T this() {...}
>     T this(int x) {...}
>     T this(double x) {...}
> }
> 
> and:
> 
> template IsSomethingOrWhatever(T) {
>     const this = ...;
> }

I like it.


Sean



More information about the Digitalmars-d mailing list