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,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-21 03:57:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? Date: Fri, 21 Jun 2002 13:03:32 +0200 Message-ID: <4006huok6mmo59d3lmkvqt3ffpccu0c2d6@4ax.com> References: <3d0ce154_5@news.bluewin.ch> <3d0e574d_2@news.bluewin.ch> <3d0fb5e8$1_3@news.bluewin.ch> 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: fu-berlin.de 1024657071 10789948 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:26545 Date: 2002-06-21T13:03:32+02:00 List-Id: On Wed, 19 Jun 2002 10:35:18 -0400, "Marin David Condic" wrote: >I've seen these suggested in this thread and others. I guess I don't like >the way it looks and I think there is a problem with it. In C, the "=" >operator is a function call with side effects. In Ada the ":=" operator is >*not* a function - its a primitive operation of the language. Creating >things like "+:=" and "-:=" (and next we'll need some flavor of the "z = (a >> b) ? a : b;" operation? :-) ?: is another story, but do not blame C for it. Ada has "and then" and "or else", which are not much better from a puristic point view. [ It is of course not so, that I liked Ada have ?: (:-)) ] >starts confusing the concept of assignment as >a primitive operation and (possibly user definable) functions. There is nothing wrong with that. A function could be a primitive operation. But assignment should be a procedure, not a function. We already have operations (+, -, *, / etc) implemented by functions. Why not to have operators (+:=, -:=, etc) implemented by procedures or entry points? >People here have posted wishing Ada would allow them to define a function >":=" just like they can define "=", but it falls apart because ":=" isn't a >function. What's wrong with: procedure '':=" (Target : in out A; Source : A); -- (*) Note I do not demand that the copy constructor would be derived from ":=". It is IMO a wrong idea to attempt to derive one from another. C++ does it simplier. What is actually wrong in C++ is that the result of "=" is not void. >Wouldn't it also fall apart if we started including "+:="? No, they should be just user-defined procedures. Whether they are primitive or not should only depend on the freezing rules and whether particular parameters are class-wide. (*) There is a minor problem with unconstrained subtypes passed as inout and that discriminants cannot be changed. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de