From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3498dd887729ed19 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Garbage Collection in Ada Date: 1996/11/06 Message-ID: #1/1 X-Deja-AN: 194890370 references: <01bbc6a3$4cf03480$829d6482@joy.ericsson.se> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-11-06T00:00:00+00:00 List-Id: In article , Matthew Heaney wrote: >Language designers: any reason why overloading "all" would be too hard? Well, functions return values (or constant objects, if you want to be precise in Ada 95 terms), whereas "P.all" returns a variable (if P is an access-to-variable type). So it wouldn't work. C++ has references, which are more like variables. (By the way, I find the notation ".all" to be rather ugly -- I prefer Pascal's "^", or even C's "*".) I agree with your point, though. It's not just ".all", but many notations in Ada are predefined, so you can't make a user-defined abstraction that "looks like" a predefined one. For example, suppose you want to have an associative array data type, which is just like a normal array, except that the index type can be something like String. You can do that, but you have to use a different notation for array indexing, aggregates, etc. Or, suppose you want to make a multi-precision integer type, which is just like a normal integer, except it won't overflow on large numbers. Well, you can't use numeric literals, case statements, etc. The danger of course is that if the user defines a numeric literal to do something weird (with side effects!), then the program is harder to understand. But that problem already exists in Ada for "+", for example. The answer is for the programmer to use good taste when redefining "+". - Bob