[Nickle]Type narrowing

Carl Worth nickle@nickle.org
Mon, 29 Jul 2002 20:20:06 +0000


On Jul 26, Keith Packard wrote:
 > The question is whether this narrowing is reasonable, or whether I should 
 > just use the single least upper bound type in all cases.

Not a direct answer to your question. But you got me thinking.

It seems to be that poly and union are functionally equivalent. (union
defines a type that can hold a value of any type belonging to a set of
types given in the union definition. poly is effectively a union with
an unrestricted set of allowable types).

Given that, might it not make sense to use the union value syntax when
narrowing the type of a poly value? Beyond making the union/poly
similarity more obvious, this would also have the benefit of making
more run-time type checking explicit in the code.

-Carl

-- 
Carl Worth                                        
USC Information Sciences Institute                 cworth@east.isi.edu
3811 N. Fairfax Dr. #200, Arlington VA 22203		  703-812-3725