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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c424d8135e68278 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-19 11:21:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.bc.tac.net!news.bc.tac.net!not-for-mail Sender: blaak@TORUS Newsgroups: comp.lang.ada Subject: Re: Ada2005 References: <9v4jsj$bd1$1@infosun2.rus.uni-stuttgart.de> <9v7f26$qn2$1@infosun2.rus.uni-stuttgart.de> <3C1754BA.C4560423@informatik.uni-jena.de> <3c1868b2.1587625@News.CIS.DFN.DE> From: Ray Blaak Message-ID: Organization: The Transcend X-Newsreader: Gnus v5.7/Emacs 20.7 Date: 19 Dec 2001 11:19:01 -0800 NNTP-Posting-Host: 208.181.209.61 X-Complaints-To: news@bctel.net X-Trace: news.bc.tac.net 1008789651 208.181.209.61 (Wed, 19 Dec 2001 11:20:51 PST) NNTP-Posting-Date: Wed, 19 Dec 2001 11:20:51 PST Xref: archiver1.google.com comp.lang.ada:18112 Date: 2001-12-19T11:19:01-08:00 List-Id: "Mark Lundquist" writes: > "Ray Blaak" wrote in message > Doesn't it make a mishmash of the name resolution rules? Consider > > type Note is private; > > function Pitch (Subject : Note) return Note_Properties.Pitch; > function Length (Subject : Note) return Note_Properties.Length; > > private > > type Note is record > Pitch : Note_Properties.Pitch; > Length : Note_Properties.Lenght; > end record; > > In the body of the package, how do you resolve the name "X.Pitch" for an X > of type Note? First off, I should say that I am not strongly advocating this change to be made to Ada, even though I would prefer if I could do this kind of thing. This is really only a thought experiment. At any rate, I would resolve X.Pitch by saying that record fields "win" if the field is accessible. The Pitch method would win only if: a) Note is accessible as a tagged type at the point of call b) Pitch is not accessible as a field at the point of call c) Pitch is accessible as a primitive operation at the point of call If both the field and method are accessible and are ambiguous, one could just choose the field, since that is existing Ada semantics. A warning about the ambiguity could possibly also be reported, so as to inform the user. For regular record types (or any other type, for that matter), this syntactic transformation need not apply. I only prefer it for OO programming, where I tend to think in terms of asking an object to do something, as opposed to asking something to be done to an object, if you know what I mean. -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@telus.net The Rhythm has my soul.