August 01, 2007 Re: Two standard libraries? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steve Teale | Steve Teale Wrote: > It seemes to me that given Walter's definition of the language - a system programming language - that Phobos is closer to the mark. If users want a more object oriented standard library, that's all well and good, but it should be a shoe-in, then if you want to use the OO stuff you can, but code that's been written to work with Phobos should work unmodified with other libraries. (Note the recent discussion on C++ security). Any other approach seems to me to reek of vanity. > it would be so much better if one could use both tango and phobos, for some things procedural programing makes more sense, sometimes OO programing makes more sense, and theres nothing to keep these too situations isolated from each other, since a program only imports the modules it needs I don't see why both phobos and tango can be used simultanously. > I am not saying that Phobos is perfect. It has lots of omissions, but I have a feeling that it is about at the right level to enable authors to write the more OO stuff on top of it. > this is the approch that makes the most since to me, though a semi-standard library like boost for c++ would be nice. the only reason I can see for rewriting the same functionality that exist in the standard library is if the existing code is slow, or completely broken | |||
August 01, 2007 Re: Two standard libraries? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ender KaShae | Ender KaShae wrote: > Steve Teale Wrote: > >> It seemes to me that given Walter's definition of the language - a system programming language - that Phobos is closer to the mark. If users want a more object oriented standard library, that's all well and good, but it should be a shoe-in, then if you want to use the OO stuff you can, but code that's been written to work with Phobos should work unmodified with other libraries. (Note the recent discussion on C++ security). Any other approach seems to me to reek of vanity. >> > > it would be so much better if one could use both tango and phobos, for some things procedural programing makes more sense, sometimes OO programing makes more sense, and theres nothing to keep these too situations isolated from each other, since a program only imports the modules it needs I don't see why both phobos and tango can be used simultanously. Consider Tangobos. :) http://dsource.org/projects/tangobos -- Chris Nicholson-Sauls | |||
August 01, 2007 Re: Two standard libraries? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | Daniel Keep wrote:
>
> Chris Nicholson-Sauls wrote:
>> renoX wrote:
>> Here's an odd thought: "%{08x:X}"
>> Wherein the {}'s mean, "this is looking at a variable outside", and the
>> ':' means "everything after this point is the variable's name".
>>
>> -- Chris Nicholson-Sauls
>
> I actually played with something similar for a while, but eventually
> discarded it. The problem was that there are times when you don't care
> to format some expression, you just want to output the thing. I didn't
> like that you'd have to carry around the leading ':' when you're not
> using it.
>
> OTOH, this is pretty similar to what Tango uses in its formatter. IIRC,
> it's something like {n:f} where ':f' is your optional format string and
> 'n' is the position of the thing you want to format. Or it might be the
> other way around; I dunno :P
>
> -- Daniel
Tango formatting is '{' [index] [',' alignment] [':' format] '}'
Where alignment is really a minimum width, and the format depends on the type you are formatting (the default is "s" as with Phobos' formatting).
Maybe my odd thought would be better as "%{X:08x}" then? Hmm.
-- Chris Nicholson-Sauls
| |||
August 01, 2007 Re: Two standard libraries? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ender KaShae | > it would be so much better if one could use both tango and phobos, for some things procedural programing makes more sense, sometimes OO programing makes more sense, and theres nothing to keep these too situations isolated from each other, since a program only imports the modules it needs I don't see why both phobos and tango can be used simultanously. Tangobos. I know that's not the point of it, but it works for that. > > > I am not saying that Phobos is perfect. It has lots of omissions, but I have a feeling that it is about at the right level to enable authors to write the more OO stuff on top of it. While we _can_ write more OO stuff on top of Phobos, someone else (the Tango team) has already done & tested it. Why reinvent the wheel? | |||
August 02, 2007 Re: Two standard libraries? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to renoX | renoX wrote: > Daniel Keep a écrit : >> >> renoX wrote: >>> ... >>> I agree with you that cout or Stdout strike me as particularly ugly and >>> that writefln is a (small) progress over printf. >>> >>> But when I see Ruby's way: puts("X is ${X}\n"); I can't help but feeling >>> that even writefln is not enough.. >>> >>> renoX >> >> http://while-nan.blogspot.com/2007/06/mixins-ctfe-and-shell-style-variable.html >> > > Yes, I've did something similar (I've posted it in the newsgroup some time ago), but what I wonder is why does Tango devs didn't use such solution instead of their current not-very pretty one.. > printf("X is: %s\n", toStringz(x)) > cout << "X is: " << x << endl; > Stdout("X is: ")(x).newline; > writefln("X is: %s", x); Would people actually use mixin(puts("X is ${X}\n")); ? Mind you, when AST macros come, it would be trivial to replace mixin(puts(...)) with puts(...), so user code would not be condemned to ugliness forever. But it sure would be nice to have some way to get macro syntax using CTFE mixins. >> Just you wait until I get me grubby little mittens on AST macros... >:) > > Yup, I've put my solution on freeze until macros.. > > renoX > > >> >> -- Daniel | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply