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-18 03:55:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed1.bredband.com!bredband!news.algonet.se!newsfeed1.telenordia.se!algonet!uni-erlangen.de!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) Newsgroups: comp.lang.ada Subject: Re: Ada2005 Date: Tue, 18 Dec 2001 11:55:31 GMT Message-ID: <3c1f292d.11941015@News.CIS.DFN.DE> 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> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) X-Trace: fu-berlin.de 1008676533 17062859 212.79.194.111 (16 [77047]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:18045 Date: 2001-12-18T11:55:31+00:00 List-Id: On 17 Dec 2001 09:50:30 -0800, Ray Blaak wrote: >dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) writes: >> However, what people criticizing Ada usualy want, is just a syntax >> sugar, which would allow to refer methods using postfix form if there >> is only one dispatching [or class-wide] argument and it is the first >> one. > >Like me. > >> I think in a future revision there could be some variant of rename >> statement which would allow to do this and also the opposite thing >> [for "methods" of protected objects and tasks which are always called >> using the postfix form]. For instance: >> >> type Ellipse is tagged ... >> procedure Draw (Figure : Ellipse, Where : Point); >> entry Ellipse.Draw (Where : Point) renames Draw; > >Why not make it automatic? The extra declaration is tedious and requires extra >maintenance. > >Given: > > e : Ellipse; > >then have > > e.Draw(p) > >be valid iff Draw exists with an Ellipse as its first parameter. Maybe. Though, then you should allow funny constructions like: e."abs", when function "abs" (X: Ellipse) return ... is defined. Also you should support fully qualified forms like: e.Geometry.Flat.Figures.Conic.Float_Figures.Ellipse.Draw (p); >Then it is truly just an alternate syntax to be used if desired, and not used >if not. > >Where it gets wierd, I suppose, is if one has an "in out" or "out" >parameter. One wants to allow update methods, but does e.Draw(p) make sense if >e is completely replaced? Neither "in out" nor "out" mean that the argument is replaced. It depends on by-copy vs. by-reference parameter passing mode. Though, for tagged types by-reference is a requirement [to support redispatch, I suppose (:-()]. procedure Draw (Figure : Ellipse, Where : Point); is an equivalent to C++ virtual void Draw (Point Where) const; procedure Draw (Figure : in out Ellipse, Where : Point); is an equivalent to virtual void Draw (Point Where); Only for "out" C++ has no analogy. Regards, Dmitry Kazakov