toString vs. toUtf8

Christopher Wright dhasenan at gmail.com
Tue Nov 20 11:18:02 PST 2007


Kris wrote:
> "Walter Bright" <newshound1 at digitalmars.com> wrote
>> Lars Ivar Igesund wrote:
>>> Walter Bright wrote:
>>>
>>>> Lars Ivar Igesund wrote:
>>>>> Only if you have recognized wstring and dstring as good names for those
>>>>> aliases <g>
>>>> They'd be consistent with wchar and dchar.
>>> Right ... now I don't like those either ;)
>> What can I say? !!
> 
> hehe
> 
> Well, perhaps it's worth noting that all of these names are probably a 
> cousin of "hungarian notation", since the name is being decorated with some 
> kind of indicator of what it represents? The question perhaps should be - 
> why is that? If we speculate, for a moment, that the language supported 
> overload on return type:
> 
> char[] toString();
> wchar[] toString();
> dchar[] toString();
> 
> then, there would be no issue here. Right? However, we don't have 
> overload-on-return-type, so it seems to me that the decorated names are a 
> means to work around that. Does that seem logical?  Perhaps what we're 
> seeing here, Walter, is a measure of distaste for the notion of 
> decorated-names? 

class String {
    char[] opImplicitCast () {}
    wchar[] opImplicitCast () {}
    dchar[] opImplicitCast () {}
}

String toString () {}

How does that look?



More information about the Digitalmars-d mailing list