On Wed, Sep 20, 2000 at 04:12:09AM -0000, Perl6 RFC Librarian wrote:
> Add null() keyword and fundamental data type
I think that this is better done as a special overloaded object used
by database modules which wish to implement SQL-style tri-state logic.
Given that making overloaded objects fast appears to be a major
design goal of Perl6, there should be no serious performance problems
to this.
The one thing which this requires that Perl5 does not have is the
ability to overload the defined() operation on an object. Other
than that, the following code produces a usable null object:
package Null;
use overload '""' => sub { undef },
bool => sub { undef },
'0+' => sub { undef },
nomethod => sub { bless {} };
sub null() { bless {}; }
print " 1 + 1 = ", ( 1 + 1), "\n"; # 1 + 1 = 22
print "null + 1 = ", (null + 1), "\n"; # null + 1 =
print " 1 + null = ", ( 1 + null), "\n"; # 1 + null =
print "null + null = ", (null + null), "\n"; # null + null =
print "defined(null) = ", defined(null), "\n"; # defined(null) = 1 (error)
I don't think that we would be well served by confusing the state of
truth in core Perl any further than it is now, especially when the
desired functionality does not need to be in the core.
Incidentally, I'm surprised that DBI hasn't added an option to use
an overloaded null object, if this feature is in demand.
- Damien
- Re: RFC 263 (v1) Add null() key... Russ Allbery
- Re: RFC 263 (v1) Add null() key... Glenn Linderman
- Re: RFC 263 (v1) Add null() key... John Porter
- Re: RFC 263 (v1) Add null() key... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamental data ... Sam Tregar
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamen... Sam Tregar
- Re: RFC 263 (v1) Add null() keyword and fund... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamental data ... H . Merijn Brand
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamental data ... Damien Neil
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Graham Barr
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamen... Damien Neil
- Re: RFC 263 (v1) Add null() keyword and fund... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamental data ... Simon Cozens
- Re: RFC 263 (v1) Add null() keyword and fundamental data... Damian Conway
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Glenn Linderman
- Re: RFC 263 (v1) Add null() keyword and fundamental ... Damian Conway
- Re: RFC 263 (v1) Add null() keyword and fundamen... Glenn Linderman
