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-Thread: a07f3367d7,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Operation can be dispatching in only one type Date: Mon, 30 Nov 2009 15:43:21 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <025105f2-5571-400e-a66f-ef1c3dc9ef32@g27g2000yqn.googlegroups.com> <1h9hilcg5i6il.12edpgu4szw1h.dlg@40tude.net> <1wtsriaxu0s4s$.ikwnnz5teukp$.dlg@40tude.net> <1iipp3bn16fe2.yqa1gz1ru17a$.dlg@40tude.net> <18wh86jvjvoe0.cofxcc8udm6q$.dlg@40tude.net> <53a35ed9-88ac-43dc-b2a2-8d6880802328@j19g2000yqk.googlegroups.com> <4b091fb9$0$6567$9b4e6d93@newsspool4.arcor-online.net> <1w0q3zxzw79pt$.5z0juiky7kfd$.dlg@40tude.net> <0f177771-381e-493b-92bb-28419dfbe4e6@k19g2000yqc.googlegroups.com> <1nbcfi99y0fkg.1h5ox2lj73okx$.dlg@40tude.net> <59acf311-3a4a-4eda-95a3-22272842305e@m16g2000yqc.googlegroups.com> <3pvk14f2iizi$.b3u242o1oqla.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1259613792 6133 192.74.137.71 (30 Nov 2009 20:43:12 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 30 Nov 2009 20:43:12 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:Oy8vayGnw0UP+v9AkwlukKoYNeI= Xref: g2news1.google.com comp.lang.ada:8257 Date: 2009-11-30T15:43:21-05:00 List-Id: "Dmitry A. Kazakov" writes: > The word assignment for most people is associated with state change, > assuming that there was some state before. So > > X : T := F (Y); > > looks equivalent to > > X : T; > begin > X := F (Y); > > But they are not. Right. I think they should be equivalent. My solution is to use two different symbols for (initial) assignment and (subsequent) reassignment. >... I would prefer proper constructors, e.g. > > X : T (Y); -- Y is a constraint of T, parameter of the constructor > > I don't like functions returning limited objects. I know you don't, but I don't understand why. Using named functions as constructors has a big advantage -- you can have more than one, and you can give them meaningful names. For example: X : Sequence := Empty_Seq; Y : Sequence := Singleton_Seq (Item => 123); Z : Sequence := Make_Sequence (Length => 123); With discriminants, what does the 123 mean? You have to pick one. > But there also are two other forms of standard assignments. Depending on > whether the left part is available: > > procedure ":=" (Left : in out T; Right : T); > > and > > function ":=" (Right : T) return T; > > Ada uses the second form, but obviously there are important cases where the > first form is preferable (and conversely). > > And further, there are three variants per each concerning dispatch: > > procedure ":=" (Left : in out T; Right : T); -- Full MD > procedure ":=" (Left : in out T; Right : T'Class); -- Target-controlled > procedure ":=" (Left : in out T'Class; Right : T); -- Source-controlled > > It would be difficult to sort this out! (:-)) Yeah, I'm not sure what the right answer is. - Bob