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: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: Tue, 24 Aug 2004 09:07:03 +0200 Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <1w3sfkwcp4q0e.1u4xeln7msgi5$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de jdsPz1exxBBtWROotVn2PAD24H1xwyX9N0UvBlPxAOurYtPJ8= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:2952 Date: 2004-08-24T09:07:03+02:00 List-Id: On Mon, 23 Aug 2004 22:20:59 GMT, Richard Riehle wrote: > "Dmitry A. Kazakov" wrote in message > news:1w3sfkwcp4q0e.1u4xeln7msgi5$.dlg@40tude.net... >> Regarding limited types: > >> Whether it was a fundamental flaws is a question, but not everybody is >> happy with limited types. They are a mixture of quite different concepts >> which probably should be dealt separately: >> >> 1. No assignment, never >> 2. No predefined [in]equality >> 3. Cannot be initialized (who need such? Ada 2005 will probably fix that) >> 4. Cannot be copied (no copy constructor) >> 5. Passed by reference >> > Of your criticisms, only number 3 is an occasional, but not insurmountable > nuisance. > > I take 1 and 4 together. Assignment and copy are identical in many > respects. When I design with limited types, I nearly always include a > "copy" procedure in my design. Someties I include a "Move." And > sometimes I include a more specific "copy" one that tells the client > of my package specifically what to expect in calling the copy procedure. I would separate copy constructors from ":=". You may have no copy constructor, preventing by-copy parameter passing, but still have ":=". Similarly you can have a copy constructor and so an ability to pass something by copy, but no ":=" (for example, to prevent random numbers or smart pointers from copying). Though one can generate ":=" from a copy constructor, what Ada compilers actually do, they are unrelated. Why not to open this mechanics for user-defined types? In my view absence of constructors is a real problem of Ada. Should we have them (and for all types), many problems (user-defined assignments, streaming limited tagged types, construction of limited types on the stack, effective implementation of user-defined access types [smart pointers], default values for standard types etc) could be solved. I agree that it would not be easy to do. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de