Re: explicit boolean accessor

[email protected] ("David L. Nicol")
Newsgroups perl.perl6.language.objects
Organization University of Missouri - Kansas City supercomputing infrastructure
Message-ID <[email protected]>

Exactly.  The :bool attribute becomes a shorthand for that.


Nathan Torkington wrote:
> 
> David L. Nicol writes:
> > What if perl6 kept it as the default, but allowed any class
> > to override the object->BOOLEAN accessor which will return
> > um, a special TRUE and FALSE which only make sens in boolean
> > contexts?
> 
> Like:
> 
>   use overload
>     'bool' => \&my_truth;
> 
>   sub my_truth {
>     1;  # objects of this class are always true
>   }
> 
> This works in Perl5.
> 
> Nat

-- 
                          David Nicol 816.235.1187 [email protected]
                      Does despair.com sell a discordian calendar?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.