Don wrote:
Georg Wrede wrote:
One thing we sholuld be wary of is overdesign. BigInt is ok, but by
the time we try to include a class called
CompleteSimulationOfAnF1RaceCar, we're screwed. :-) I see no way to
incorporate them into writefln or even plain writeln. Or at least, no
*use*.
I think it'd be reasonable to limit things to the options available for
built-in types. Outside of that, custom formatting functions make a lot
of sense. The problem is that toString() _looks_ like it emulates
built-in formatting, but it only does '%s'. So it's really beguiling.
Heh, one thought is, suppose we could have arbitrary format
specifications in writef. Say, if we wrote %&lkjasdf; this string would
be passed to toString. (It would of course be up to the class to
error-check the string, writefln obviously cant (or shouldn't) do it.)
So, things are doable. But I'm really not looking forward to that kind
of sports. Any elaborate printing or formatting should be handled
outside writefln &co.
BTW, when passing the output to a sink, it should be possible to (say)
format your members with '%x' format, but you can't do that by
permanently altering sink: it should revert to its previous value once
you've sunk your last member. (I think this C++ iostreams got this wrong).
I guess they, too, thought of making it "easier" in the wrong place.
Just because you can, doesn't mean you have to.
(OT: an excellent example of this It's Done Because We Noticed We Could
stuff is in Firefox. When a picture is a link to another page, and you
want to drag that to the tab area, the entire picture is dragged with
the mouse. Now, how the hell am I supposed to hit the small tab area
when the large picture covers half of my Firefox??
So now I have to learn to remember to grab bigger pictures near some
edge. And I really can't see *any* valid benefit for having to drag the
picture. I'd rather have it the old way, where the mouse pointer simply
changes shape, so you know you're dragging. Damn, damn...)