[Prev][Next][Index][Thread]

Re: Extending format strings.



"Rob Myers" <robm@h2g2.com> wrote in message
974199664.28658.0.nnrp-12.c3ad61e3@news.demon.co.uk">news:974199664.28658.0.nnrp-12.c3ad61e3@news.demon.co.uk...
>> I'm a little fuzzy on the distinction between %= and %S.  When would
>> I use which one?  Why?

> %= is when you don't know what you're going to be printing, it's just
> some subclass of object, anything goes. %S is when you know what you're
> going to be printing and you'd like some type safety.

How does %S give me type safety?  If I override print-message for <foo>,
<bar> and <booger>, I can still screw up by using the control string "%S %S
%S" and calling with (<foo>, <booger>, <bar>) instead of the expected
(<foo>, <bar>, <booger>).  And since there's a print-message for <object>,
it isn't even as if my not having a handler for a particular type will get
caught.  I'll just get irritating results instead.





References: