This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
New 'tristate' pragma to allow undef to take on NULL semantics
=head1 VERSION
Maintainer: Nathan Wiger <nate@wiger.org>
Date: 23 Sep 2000
Last Modified: 29 Sep 2000
Mailing List: perl6-language@perl.org
Number: 275
Version: 2
Status: Frozen
=head1 ABSTRACT
RFC 263 proposed the introduction of a C<null> keyword for introducting
tristate logic into Perl 6. However, that was abandoned in favor of the
approach specified here, a C<tristate> pragma.
=head1 DESCRIPTION
The C<tristate> pragma allows for undef to take on the RDBMS concept of
C<NULL>, in particular:
1. Any operation between a NULL and any other value results
in NULL
2. Any comparison between a NULL and any other value is false
3. No NULL value is equal to any other NULL
4. A NULL value is neither defined nor undefined
The C<tristate> pragma is lexically scoped, so that it obeys code
blocks:
$a = undef;
$b = 1;
$c = $a + $b; # 1
{
use tristate;
$d = $a + $b; # undef
}
$e = $c + $d; # 1
In addition, the C<defined> builtin is overloaded as an "is not null"
operator under the pragma:
use tristate;
$name = undef;
die "Badness" unless defined $name; # $name is not null
This simplifies C<undef>, actually: C<defined($x)> will always return
false if C<$x> is C<undef>, regardless of the C<use tristate> pragma.
For more details on theoretical issues, please see the references or RFC
263.
=head1 IMPLEMENTATION
No idea, too burned out.
=head1 MIGRATION
None, unless some fool has a custom C<tristate> module that they
wrote to navigate the tristate area of New York, New Jersey, and
Connecticut. But that should be C<Tristate> anyways.
=head1 REFERENCES
RFC 263: Add null() keyword and fundamental data type
http://www.sitelite.nl/mysql/manual_Problems.html#IDX666
http://www.unb.ca/web/transpo/mynet/mtx19.htm#r2