D Conference Tango Phobos

Sean Kelly sean at f4.ca
Fri Sep 14 07:28:42 PDT 2007


Steven Schveighoffer wrote:
> "Sean Kelly" wrote
>> Well, the first issues to address are the few incompatibility points 
>> between Tango and Phobos within the runtime, the most visible being 
>> Object.toString in Phobos vs. Obejct.toUtf8 in Tango.  This likely means 
>> toUtf8 in Tango will have to change to toString, so if anyone absolutely 
>> hates the idea, you're welcome to say so :-)
> 
> Can you just have both?  i.e.:
> alias toUtf8 toString;
> 
> Of course, one has to override only the real one in the classes, so I guess 
> that becomes ambiguous as to which one is better.
> 
> To me, I think toString is more clear.  BTW, I think utf-8 has multi-byte 
> characters.  If that's the case, then isn't toASCII more appropriate?

D uses utf-8 as the encoding format for char[] strings, which was the 
original reason for using toUtf8 in Tango--it specifies the encoding of 
the return data.  toString doesn't specify an encoding so it's okay as 
well so long as the library doesn't contain a String class, and Tango 
does.  So we'll likely have to rename it to something else.

>> However, I suspect there is a quiet majority using Phobos
> 
> I used Phobos for about 4-5 days until I started wanting to use network 
> sockets and select.  Then I discovered that Phobos' support of it was rather 
> lacking, and looked around and landed on tango.
> 
> I like it much better.
> 
> I think more people would use Tango if it was downloaded by default.  Sort 
> of like the Netscape vs. IE...
> 
> BTW, I'm not saying phobos sucks, I'm just saying I prefer tango.  Except 
> for toUtf8 :)

I think a lot of people feel the same about toUtf8 :-)  Personally, I 
like that it says exactly what will be returned and that it's a 
consistent name across the library for any point that returns a char[] 
string, including routines to convert between char[], wchar[], and 
dchar[] (which is done in std.utf in Phobos).  But it's not easy to 
dislodge the opinion that the name is ugly.


Sean



More information about the Digitalmars-d mailing list