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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-20 01:28:10 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: idem (Was: += in ada) Date: Mon, 20 Oct 2003 10:28:57 +0200 Message-ID: <7v47pvsgqi529kbsg4g3roc9fslh3ht64g@4ax.com> References: <3F7316F7.219F@mail.ru> <17cd177c.0310010606.52da88f3@posting.google.com> <3F9391B3.1080001@crs4.it> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1066638488 27752693 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:1189 Date: 2003-10-20T10:28:57+02:00 List-Id: On Mon, 20 Oct 2003 09:41:39 +0200, Jacob Sparre Andersen wrote: >Preben Randhol wrote: > >> The problem I have with idem is that it looks like just another >> variable. > >Yes. But it is a cool idea. And with a suitable idem marker, I think >it would make it possible to write even more readable code. Also, >"idem" doesn't look any more like another variable than the operators >"and", "or" and "not". > >What I worry most about with idem is that it would make the expression >syntax used in assignments different from that used in other places. Probably there could be a generalization. Consider assignment as a procedure: procedure ":=" (Idem : in out Type; Right : Type); Then in X := Idem + 1; Idem would be just the name of a formal parameter. This could be applicable to all kinds of subroutines. Of course, a direct use of a parameter name would lead to possible name clashes. So it would be better to have a special notation to access the parameter names as "=>" does. For example: X := ":=".Idem + 1; It looks extremely ugly, but illustrates the idea. So for a function Mean one could write something as unreadable as: X := Mean ( Left => Some_Awfully_Complex_Expression, Right => Mean.Left * 3.0 ); This would also impose additional requirements on parameter evaluation order. Or else, allow excellent: Mean (Left => Mean.Right, Right => Mean.Left); All C++ programmers will immediately switch to Ada, to have this! (:-)) -------- In one of previous incarnations of this ever lasting thread there was made a better proposal for idem. We could allow loop labels for the assignment statement: [