overloading operators for I/O
renoX
renosky at free.fr
Fri Feb 16 23:31:52 PST 2007
Frits van Bommel a écrit :
> renoX wrote:
>> - a syntax 'a la Ruby' would permit to see better the resulting string:
>> writef("x is %{vx}, y is %{vy}\n"); of course you could still specify
>> the format if you want: writef("x is %08x{vx}\n");
>
> A syntax like this may be possible with string mixins. I'm pretty sure
> you could write that like this:
> ---
> mixin(write!("x is %{vx}, y is %{vy}\n"));
> ---
> and get away with it, given the proper 'write' template. It might not
> even be very difficult, it'd just need to find the %{} groups, parse
> them out and generate the proper call(s) to other functions. The backend
> could be writef, or Tango's Stdout.format or something custom-written.
I know, that's in my TODO list, but I wanted to do 'printable enums'
first and I had 'startup' problem (not being very familiar with template
programming).
Now that kevin bealer has provided 'reflexive enums', I want to refine
the implementation (struct or not struct?), do the write stuff, then
world domination.
renoX
More information about the Digitalmars-d
mailing list