Message from discussion
Testing for null
Newsgroups: perl.perl6.internals
Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <boemm...@physik.uni-kl.de>
Mailing-List: contact perl6-internals-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-intern...@perl.org
Delivered-To: perl6-intern...@perl.org
X-Authentication-Warning: helium.physik.uni-kl.de: boemmels set sender to boemm...@physik.uni-kl.de using -f
Sender: boemm...@physik.uni-kl.de
To: Perl6 Internals <perl6-intern...@perl.org>
Subject: [RfC] Testing for null
Date: 03 Dec 2003 15:46:11 +0100
Message-ID: <m2y8tu0xjg.fsf@helium.physik.uni-kl.de>
Lines: 24
User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Check-By: one.develooper.com
X-Spam-Status: No, hits=-0.6 required=7.0 tests=CARRIAGE_RETURNS,SPAM_PHRASE_00_01,USER_AGENT,USER_AGENT_GNUS_UA,X_AUTH_WARNING version=2.44
X-SMTPD: qpsmtpd/0.26, http://develooper.com/code/qpsmtpd/
Approved: n...@nntp.perl.org
From: boemm...@physik.uni-kl.de (Juergen Boemmels)
Hi,
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.
Comments
boe
--
Juergen Boemmels boemm...@physik.uni-kl.de
Fachbereich Physik Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47