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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-31 10:16:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed.vmunix.org!fu-berlin.de!uni-berlin.de!dialin-145-254-039-076.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: Sat, 31 May 2003 19:18:41 +0200 Organization: At home Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3ED41344.7090105@spam.com> <3ED46D81.FF62C34F@0.0> <3ED46E07.4340CABC@0.0> <3ED4F3FD.A0EF7079@alfred-hilscher.de> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-039-076.arcor-ip.net (145.254.39.76) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1054401376 7943104 145.254.39.76 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:38226 Date: 2003-05-31T19:18:41+02:00 List-Id: Bill Findlay wrote: > On 31/5/03 12:42, in article uisrrnxzk.fsf@wanadoo.fr, "Pascal Obry" > wrote: >> >> Right! I must be a bit tired to forget that :) So I think it could be >> /:= *:= +:= and -:= (operators before the :=). > > What about and, or, xor, rem and mod? "mod:=" ? I hope not! You forgot :**= and unary :+=, :-=, :not=. For example: X :not=; -- C people will envious! (:-)) > I find this proliferation of special notations revolting. Rather tasteless, I would better allow: procedure "+" (L in out T; R : T); then one could write: declare X : T := ...; begin X + 1; > An "idem" feature, meaning, "the same as the destination" and used thus: > > 1. I := (idem + 1); -- or perhaps: (<> + 1); or maybe: (all + 1); > > 2. I := (1 - idem); -- N.B. not possible using any ?:= operator > > 3. X := 0.5*(idem + a/idem); And crowning: 4. I : Integer := idem + 1; -- OK, just a joke > gives a lot more expressive power than update-in-place operations, but > allows the latter to be implemented very easily in most cases that > significant efficiency gains are possible (though not, admittedly, > arithmetic operations overloaded on matrices and other structures for > which conventional, if slightly heavier, procedural notations remain). I have an alternative / additional proposal. The programmer declares in-place operations and instructs the compiler to deduce unary and infix operators from them. For example: procedure Inc (X : in out T; By : T); function "+" (X, Y : T) return T; for "+" use Inc (X => X, By => Y); > The idem notation also documents the programmer's intention more clearly > in the cases (such as 3) in which the RHS subexpression is necessarily the > same as the LHS, but which do not fit the limitations of a ?:= operation. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de