chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] New immediate values (was: DBI)


From: John Cowan
Subject: Re: [Chicken-users] New immediate values (was: DBI)
Date: Fri, 29 Feb 2008 17:28:37 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

Thomas Chust scripsit:

> this is really a question of taste, isn't it? You could just as well argue 
> that a NULL value should be of a type that is a subtype of every other 
> existing type but contains no other concrete instances, which would imply 
> that all the type predicates should return #t when applied to the NULL 
> value. This makes a lot of sense when the NULL value is used to indicate 
> the absence of an object reference and is the way it is handled in several 
> object oriented languages.

As far as I know, no OO language does that.  They interpret (or IMHO
misinterpret) a *static* declaration that a variable is of type Foo
as meaning that it can contain a Foo or null, but nowhere is null
*dynamically* a member of type Foo: tests analogous to number?, string?,
etc. always return false on null.

Haskell spells it out: a foo-typed variable can only hold a foo, and if
you want it to be otherwise, you declare it as of type Maybe foo, which
means it can hold either a Just foo (which you can unwrap to be a foo)
or Nothing.

OT:  One of the Java puzzlers is this:

        Foo foo = null;
        foo.bar();

Under what circumstances does that *not* cause a NullPointerException?

-- 
We are lost, lost.  No name, no business, no Precious, nothing.  Only empty.
Only hungry: yes, we are hungry.  A few little fishes, nassty bony little
fishes, for a poor creature, and they say death.  So wise they are; so just,
so very just.  --Gollum        address@hidden  http://ccil.org/~cowan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]