D Conference Tango Phobos

Bill Baxter dnewsgroup at billbaxter.com
Fri Sep 14 23:49:36 PDT 2007


Janice Caron wrote:
> On 9/14/07, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>> Better support for localization for one.  Tango's routines let you
>> change the order of arguments in the format string, since the grammars
>> of different languages don't always use the same word order.  You can
>> say "{1} is {2}" in Tango, in contrast to "%s is %s" of writefln.
> 
> I understand why that functionality is a good thing, but why should
> that mean the libraries are incompatible? 

No argument from me there. I was just answering the question "why would 
you rewrite writefln?"

> Why not just give the
> function a different name, e.g. echo instead of writef, echoln instead
> of writefln?

It does have a different name in Tango.

> Not to be nitpicky or anything, but what if I want argument reordering
> /and/ formating? e.g. suppose I want to echo the second argument as
> "%+6.2f"?

Yep Tango's routines have that too.

> Or ... maybe formatting should be independent of output stream anyway.
> Maybe it should be writefln(format(...)) instead?

I think that may be one thing that is still lacking in Phobos.  You 
can't *not* do formatted output.  I recall someone provided a patch to 
add unformatted output routines, but AFAIK it was never applied.  It's a 
good example of why Phobos will never be half the library Tango is. 
Walter is the only one with write access, and he's too busy with 
compiler things to have time to review and merge Phobos patches.  It's a 
surefire recipe for Phobos going nowhere fast.

> Anyway, compatibility is way more important that what any given
> function actually does, so really that, I agree, is the issue.

It shouldn't actually be too difficult to port most Tango libraries to 
Phobos or vice versa.  I haven't tried it, but it must be a lot easier 
than porting C++ code to D, which I have done a fair share of.  I think 
the main things for most libs would just be making the trivial 
toUtf8<->toString conversion, and then rewriting any IO-using bits.  Of 
you could also just port the whole IO layer first.

--bb



More information about the Digitalmars-d mailing list