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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: operation can be dispatching in only one type Date: Mon, 30 Nov 2015 16:29:01 -0600 Organization: JSA Research & Innovation Message-ID: References: <04eb6626-644b-4b16-a329-c35659a9fbe2@googlegroups.com> <1ephv5ugr5mib$.9ehadf3dddct$.dlg@40tude.net><1nf8wc05tjtvf$.1ctjb9hsr0qsp.dlg@40tude.net><8132c558-aec2-41f4-8024-4a75a2d497ae@googlegroups.com><17c8a7kqoxvff.aa1raqev6xlu$.dlg@40tude.net> <87two4d6uk.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1448922542 12280 24.196.82.226 (30 Nov 2015 22:29:02 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 30 Nov 2015 22:29:02 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:28606 Date: 2015-11-30T16:29:01-06:00 List-Id: "Jacob Sparre Andersen" wrote in message news:87two4d6uk.fsf@adaheads.sparre-andersen.dk... > Dmitry A. Kazakov wrote: > >> type T is record >> X : Integer; >> end record; >> >> The compiler generated setter is something like inventing Ada-like >> notation: >> >> procedure ".X" (Left : in out T; Right : Integer); >> >> Called as follows: >> >> Y : T; >> begin >> Y.X := 10; > > Wouldn't it be much easier to add the simple bit of syntactic sugar > saying that given: > > procedure Setter (Object : in out T; > Field : in U); > > For a variable object, V, of (a tagged) type T, and an expression, E, of > type U, the statement: > > V.Setter := E; > > is equivalent to the statement: > > V.Setter (E); > > (Not because it is shorter - it isn't - but because it nicely mirrors > matching "getter" functions, and because it makes it clear that the > procedure call copies a value into an object and modifies it.) Certainly. That's what Dmitry meant when he said "... a kludge invented with aspects ...". We can argue just how kludgy it really is (a user-defined anything ultimately maps into a subprogram call, after all, and the syntax of a call isn't engraved in stone), but I think Dmitry has an ideal vision where all of these sorts of operations are given the same first-class level. That won't ever happen for Ada, but it might make sense for a new language design. Randy.