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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b6e97963d32ee242 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-25 02:11:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!fu-berlin.de!uni-berlin.de!dialin-145-254-040-007.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: The old "Object.Method" syntax debate Date: Sun, 25 May 2003 11:13:08 +0200 Organization: At home Message-ID: References: <254c16a.0305210726.485125de@posting.google.com> <3eccdf77$1@epflnews.epfl.ch> <3ecdd296$1@epflnews.epfl.ch> <3ED056CB.8000200@attbi.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-040-007.arcor-ip.net (145.254.40.7) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1053853856 2310213 145.254.40.7 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:37752 Date: 2003-05-25T11:13:08+02:00 List-Id: Robert I. Eachus wrote: > Alexander Kopilovitch wrote: >> Dmitry A. Kazakov wrote: >> >>>Anyway prefix syntax exists also in the form of attributes. >> >> Yes, but attributes cannot be introduced by user -- sometimes programmer >> can provide an implementation of an attribute, but isn't permitted to >> introduce his own attribute... this is a privilege for language designers >> and compiler vendors. >> (An apostrophe often is no more visible that a dot, but its upper >> position in the line suggests that the following attribute somehow came >> from a high authority -:) . > > I really don't like the idea of allowing the Object.Operation format to > Ada. Yeah, the compilers can usually figure it out understand it. But > the potential confusion with component notation is going to confuse > experienced Ada users. (And eventually other O-O language users when > the actually run into component references. However it is also a step into abstract record types. Consider: type Complex is private; function Complex.Im return Real; function Complex.Re return Real; Here Complex appears a record type with read-only members Im and Re, being internally something else (a polar complex number). > Since the language currently allows defining attributes which are > procedures or functions, why not use the apostrophe notation? Now the > meaning of Object'Operation is clear, even when it is actually > Object'Length or whatever. To have X'Image instead of T'Image (X)? That is too good to become a reality. (:-)) > Probably need a rule about overloading > predefined attributes, but that shouldn't be such a big deal. (They > would be non-overridable declarations in scope.) Actually there should be an ability to declare/rename a subroutine in any of the following formats: 1. Functional: F (...) 2. Postfix: X.F (...) 3. Attribute: X'F (...) 4. Operational: X + Y 5. Index: X (...) 6. Aggregate: (...) 7. Constructor: X : T (...) and new T (...) For both 2 and 3 the language should not allow other arguments be either dispatching or of the same type as the dedicated argument. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de