[net.lang.ada] Overloading procedures with objects

GILBERT@YALEVMX.BITNET (06/11/86)

    The problem with procedure parameters, it seems to me, is as
much a question of overloading resolution as type checking. Once
the language rules were set up, the designers may have written
themselves into a corner which precludes procedure arguments. Two
items trouble me:

       Anyproc("+");

Today this will match a procedure of that name with a string
argument. With procedure arguments, it is now overloaded on all
procedures named Anyproc which take function arguments with darn
near any two arithmetic arguments. Furthermore, even if you added
procedure-types to the language you could not resolve the
overloading since "+" is builtin and is therefore an anonymous
procedure type (just as numeric literals are formally of type
"universal_integer" which is anonymous and never explicitly
defined. There is no reasonable way to state just what "+" you
mean.

    A somewhat less difficult problem is posed by the convention
that enumeration literals are syntatically treated as
parameterless functions which return a value of the enumeration
type. Today it is possible:

type PLACE is (IN, OUT);
procedure WHERE(X:PLACE);

But now if I could declare another WHERE which took as its
argument a "Function without arguments which returns PLACE" and
then wrote:

    WHERE (IN);

Which of the two separate WHERE routines am I calling. How
syntatically can I qualify IN to distinguish whether I want it
evaluated (to produce a value of type PLACE and call the first
WHERE) or left as a procedure (to call the second one).  More
importantly, do I want the compiler to have to deal with
overloading between symbols which are not just of different types
but also really of qualitatively different categories.

    It may be possible to define extentions of a language like
PASCAL which do type checking on procedure parameters, but the
language will not have overloading. It may even be possible with
great difficulty to define a language with overloading and
parameter procedures. But I do not think that the process will
survive the syntatic peculiarities that Ada introduced when
permitting redefinable primitives, derived functions, and
overloaded enumeration literals.

jankok@zuring.UUCP (06/13/86)

I comment only on a detail.

In article <8606112104.AA28684@ucbvax.Berkeley.EDU> GILBERT@YALEVMX.BITNET.UUCP writes:
>..... Today it is possible:
>
>type PLACE is (IN, OUT);

I doubt very much that this is possible, since IN and OUT are reserved words.
-- 
Mail: Jan Kok, CWI (afd. NW), Postbus 4079, NL-1009 AB Amsterdam, Nederland
UUCP: {seismo, decvax, philabs, okstate, garfield}!mcvax!zuring!jankok
---------------------------------------------------------------
    "To know that you know what you know, and that you do not know what
     you do not know, that is true knowledge." (Kung Fu Tse)