At 03:46 PM 12/3/2003 +0100, Juergen Boemmels wrote:
I'm curently playing around with open calls returning a PMCNULL
instead of a half valid IO-Object. But the main problem with that is
that there is currently no way for the byte-code to detect such a
case.
The if and unless ops call the get_boolean vtable method which throws
an internal exception.
As we can create a PMCNULL with the null_p op there should at least
be a way to test for a PMCNULL. Two possible solutions come to my mind

* A PMCNULL has false semantics. This may be done by letting
  get_boolean return FALSE, or by adding a test to if_p_ic op:
  if(!PMC_IS_NULL($1) && $1->vtable->get_boolean($1))
* Have a special op for this if_null and unless_null which exlusively
  test for NULL.

My intention for PMCNULL was to catch invalid interpreter state, or invalid bytecode; cases which used to give us core dumps.

Explicitly returning PMCNULL and allowing tests on PMCNULL may
or may not fit into this, depending on your point of view. I'm not even
certain what my view of it is. Allowing ANY valid test on PMCNULL
seems to muddy the water by allowing it to actually be used.

The question is: should we allow a NULL register test
and would this replace Undef as the de facto way to return
"nothing". Probably the answer is "yes" but I'd like to hear Dan's
take on it.

-Melvin





Reply via email to