next version of DWT?

Frank Benoit keinfarbton at googlemail.com
Sun Apr 29 05:44:59 PDT 2007


Marcin Kuszczak schrieb:
> Frank Benoit wrote:
> 
>> Marcin Kuszczak schrieb:
>>> Just a few additional remarks and wishes for future DMD implementations:
>>>
>>> 1. With templates there is one drawback: as I know template methods can
>>> not be virtual. Maybe they could be in future?
>> This is a problem for the automated generation of these helper methods,
>> they must be available in interface and certainly they need to be virtual.
>>
> 
> Yes, it can be real problem. Probably only Walter can help here :-) I really
> don't know what to do to make it work properly.

AFAIK the vtbl needs to be known at compile time. if the SWT class is
compiled, it is not know what template argument will be applied by a
user. This is, why a template member function cannot be virtual.

So this is a blocker for using template members here. They cannot be
used in interface or for abstract methods.

> 
>> I personally don't like to write getValue!(char)() to define the return
>> type. 
> 
> This one I don't get. For char type you do not have to call template
> explicitly. Because of default template parameter of type 'char' you just
> call getValue(); and it is implicitly equivalent of getValue!(char)(); 
> Please see my example for reference.

If you want to have the method name unchanged, you need to apply the
template argument, to omit the conflict with the original method. (And i
think a default argument in the template will also generate an error)

JavaString getValue();
T[]        getValue(T=char)();

calling getValue() is ambigious

> 
> 
>> If the return type is Control[], the ported method looks like this: 
>>
>> JArrayJObject getControls();
>>
>> The D help method has return type Control[]
>> Control[]     getControls(); // conflict
> 
> When you could change:
> JArrayJObject getControls();
> into:
> JArrayJObject swtGetControls();
> 
> there would be no conflict with:
> Control[]     getControls();

Now again we have to change the method name to make it unique :)
I would prefer to let the original have the original name, and have the
helper method have the changed name.
And if it is needed for the return type, i would do it for all helpers.
'swt' is not working as a general 'escaping sequence' (porting other
projects)
How about 'dh_' ? :)





More information about the Digitalmars-d-dwt mailing list