Re: explicit boolean accessor

2000-08-18 Thread David L. Nicol
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

Re: explicit boolean accessor

2000-08-18 Thread Damian Conway
> So what you want is for overloading to become easier, probably via > predefined methods? Excellent topic for an RFC. I'm already writing it (and exactly that way, too). Damian

Re: explicit boolean accessor

2000-08-18 Thread Nathan Wiger
Nathan Torkington wrote: > > Nathan Wiger writes: > > > 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

Re: explicit boolean accessor

2000-08-18 Thread Nathan Torkington
Nathan Wiger writes: > > 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 obje

Re: explicit boolean accessor

2000-08-18 Thread Nathan Wiger
> 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 s

Re: explicit boolean accessor

2000-08-18 Thread Nathan Torkington
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; #

Re: explicit boolean accessor

2000-08-17 Thread Nathan Wiger
"David L. Nicol" wrote: > > 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? > > Hopefully someone else can come up with a good example. This is actu