Re: RFC 180 (v1) Object Class hooks into C<printf>
[email protected] (Hildo Biersma) Thu, 31 Aug 2000 08:46:47 +0100
| Newsgroups | perl.perl6.language.io |
|---|---|
| Organization | Morgan Stanley Dean Witter & Co. |
| Message-ID | <[email protected]> |
> =head1 ABSTRACT > > There needs to be a way for an object class to define C<printf> format > specifiers for use in formatting objects into strings with C<printf> and > C<sprintf>. I find myself agreeing with your sentiment, but the approach in this RFC is not sufficiently general. Why only provide hooks for printf, not for formats and output disciplines? I think a better approach would be that the to-string operator for objects should get an optional 'width' parameter. In normal cases (stringification, interpolation), that argument would not be set. In printf and formats, but maybe also by specific file disciplines (e.g. the 72-character-wide output file), the width parameter would be set and indicate how wide the object may print its data. Hildo