At 12:27 AM +0000 12/7/02, Alex Gough wrote:
D'oh! Now it's obvious.That is to say, in "if ( !exp1 ) { ... }", !exp1 merely has to be true or false, while $foo = !exp1 leaves !exp1 needing to be all manner of things.
I've been conflating the two, which is wrong.
The get_bool vtable method is specifically to retrieve the boolean state of a PMC. It returns 1 or 0, true or false, and we use it to check truthfulness.
We need a logical_not vtable entry that returns a full-fledged PMC that's the logical complement of the not-ted variable.
So "if (!$foo)" probably translates to "unless $foo, BAR" and under the hood does a get_bool on $foo. On the other hand, "$foo = !$bar" calls "not $foo, $bar" and $bar is in a position to decide what it isn't.
If a language really needs "if (!$bar)" to get a full-fledged not-ted $bar and then test it for truthfulness, it can emit "not $$temp, $bar; if $temp, FOO" or something very much like it.
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk