Dan Sugalski writes:
> It's possible, for example, for a tied/overloaded/really-darned-strange
> variable to look true but still be false. If you do:
>
> $foo = $bar || $baz;
>
> and both $bar and $baz are objects, the 'naive' way is to make $foo be
> $bar. But it's distinctly possible that $bar really should be treated as a
> false value and $baz be used instead. Why? Dunno. Serious hand-waving here.
> (And yes, I know that's a danger sign... :) But I don't see any reason to
> preclude the possibility.
You can do that right now in perl5, by using overload.pm and supplying
a 'bool' method.
An application might be when your object represents an array and you
want the boolean context of your object to report whether it has data
in it or not, to facilitate:
if ($pdl) {
# do something if the $pdl has data in it
}
Nat
- Re: A tentative list of vtable function... Bryan C . Warnock
- other parts of the guts playing wi... Bradley M. Kuhn
- Re: A tentative list of vtable functions Ken Fox
- Re: A tentative list of vtable functions Nick Ing-Simmons
- Re: A tentative list of vtable function... Dan Sugalski
- Re: A tentative list of vtable fun... Ken Fox
- Re: A tentative list of vtable... Nick Ing-Simmons
- Re: A tentative list of vtable... Ken Fox
- Re: A tentative list of vtable... Dan Sugalski
- Re: A tentative list of vtable... Dan Sugalski
- Re: A tentative list of vtable... Nathan Torkington
- Re: A tentative list of vtable... Nick Ing-Simmons
- Re: A tentative list of vtable functions David L. Nicol
- Re: A tentative list of vtable functions Nick Ing-Simmons
- Re: A tentative list of vtable functions Nick Ing-Simmons
- Re: A tentative list of vtable functions Dan Sugalski
- Re: A tentative list of vtable functions David L. Nicol
- Re: A tentative list of vtable functions Dan Sugalski
- Re: A tentative list of vtable functions Chaim Frenkel
- Re: A tentative list of vtable functions Dan Sugalski
