On Wed, Nov 5, 2008 at 23:22, Chris Dolan <[EMAIL PROTECTED]> wrote:
> In "[perl #60350] [TODO] default __get_string method", Patrick added a
> default Object.Str() that classes can override to get custom
> stringification.  Formerly, you could do that only by defining a method
> named __get_string().
>
> Currently, you can overload number context by creating a __get_number()
> method and boolean context via __get_bool().  Should there be an analogous
> Num() and Bool() method on Object?  Would it Num() return 0 by default?  And
> a default Bool() that returns True?  The Failure class would override
> negatively, and the container classes could override Num()
>
> Is this making life harder by making two methods to override, Str() and
> __get_string, Num() and __get_number(), Bool() and __get_bool()?  Maybe
> instead Str(), Bool(), Num() should be magic and automatically get a :vtable
> tag via actions.pm?  Then maybe we could drop the __get_* counterparts?
>
> I'd be happy to implement if someone would comment on the best approach.
>
there's no reason to use leading double-underscore on any of those.
it's 'get_string', not '__get_string'. that's ancient history. can you
let us know where you came up with that syntax, so we can scrub that
bad data?

~jerry

Reply via email to