Two standard libraries?

Don Clugston dac at nospam.com.au
Thu Aug 2 07:19:57 PDT 2007


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



More information about the Digitalmars-d mailing list