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]>



Perl5 has well defined but sometimes confusing "truth."


This is a weakness of it.


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?

That way there's no longer any of the "0 but true" and so
on, or at least it becomes something more general and low level
and more "polished" and less "hack."


I'm not suggesting a BOOLEAN type, because I think that's silly,
just a way to override what true means for a type without writing
the converter function into every place.


Hopefully someone else can come up with a good example.




-- 
                          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.