Re: explicit boolean accessor
[email protected] (Nathan Wiger)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
> Like:
>
> use overload
> 'bool' => \&my_truth;
>
> sub my_truth {
> 1; # objects of this class are always true
> }
>
> This works in Perl5.
Right, a lot of this stuff (like STRING and BOOLEAN) can be accomplished
through overloading. However, having a standard builtin method similar
to tie and import makes things easier and more consistent I think. If we
make "everything an object" then these become necessities.
-Nate