Re: Why Generics?
- From: "Chris Uppal" <chris.uppal@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 27 May 2005 10:54:46 +0100
Mike Schilling wrote:
> > Perhaps you could require a cast before using a nullable type ?
> >
> > Nullable%Object a;
> > ...
> > a.toString(); // error
> > ...
> > Object ann = (Object)a;
> > ann.toString() // ok
>
> Sure, but this doesn't accomplish as much; it simply raises an exception
> when a reference is unexpectedly null, exactly the way Java does today,
> rather than madate (or at least encourage) code that processes a null
> correctly.
Fair point.
Though you /could/ make it throw a checked NullCastException or something like
that.
Just out of curiosity, would you like to see some sort of compile-time null
check added to the type system ?
-- chris
.
- Follow-Ups:
- Re: Why Generics?
- From: Mike Schilling
- Re: Why Generics?
- References:
- Why Generics?
- From: David Blickstein
- Re: Why Generics?
- From: tzvika.barenholz@xxxxxxxxx
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: tzvika.barenholz@xxxxxxxxx
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: Mike Schilling
- Re: Why Generics?
- From: Chris Uppal
- Re: Why Generics?
- From: Mike Schilling
- Why Generics?
- Prev by Date: Re: Why Generics?
- Next by Date: Struts and Collections
- Previous by thread: Re: Why Generics?
- Next by thread: Re: Why Generics?
- Index(es):
Relevant Pages
|