Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!gatech!hubcap!billwolf From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) Newsgroups: comp.lang.ada Subject: Re: Overloading of assignment Message-ID: <3667@hubcap.UUCP> Date: 26 Nov 88 19:59:37 GMT References: <881125130910.218003ab@elcc.epfl.ch> Sender: news@hubcap.UUCP Reply-To: billwolf@hubcap.clemson.edu Lines: 31 From article <881125130910.218003ab@elcc.epfl.ch>, by madmats@elma.epfl.ch (Mats Weber): ! Consider the following example: ! # package ADT is # type T is limited private; # procedure ":=" (OBJECT : in out T; VALUE : in T); $ function TO_T (N : INTEGER) return T; $ private $ type T is range 0..1000; % end ADT; % % with ADT; use ADT; & procedure P is & X : ADT.T; * begin * X := TO_T(7); -- this call of ":=" is erroneous because X * end P; -- is undefined. The solution is to enable any type of object to be automatically initialized; any type of object should be able to carry the value "undefined", which is automatically assumed by all objects not otherwise initialized. The value "null" would be an alias for "undefined", to preserve compatibility. In the case of integers, for example, we typically have the range 31 31 31 31 -2 .. 2 - 1; this would shrink to -2 - 1 .. 2 - 1, using the 31 liberated value of -2 as our representation of "undefined", and rendering the range of an integer symmetrical, thus eliminating the problem of having -1 * MAXINT raise a NUMERIC_ERROR.