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-Thread: 103376,27dc164946031512 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Limited_Controlled and constructor functions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Fri, 19 Jan 2007 15:33:06 +0100 Message-ID: <1qu3xfyfc024$.phvronbnfx6j.dlg@40tude.net> NNTP-Posting-Date: 19 Jan 2007 15:33:06 CET NNTP-Posting-Host: d5fd6c8d.newsspool4.arcor-online.net X-Trace: DXC=2<7amPjnj@[PU8j_I0DN6_4IUKkgRPNBO1903UMW X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8328 Date: 2007-01-19T15:33:06+01:00 List-Id: On Fri, 19 Jan 2007 14:45:59 +0100, Maciej Sobczak wrote: > Dmitry A. Kazakov wrote: >> On Fri, 19 Jan 2007 08:58:54 +0100, Maciej Sobczak wrote: >> >>> What I want to accomplish is the functional way of building lists of >>> values of variant types: >>> >>> P : constant Params := Make_Params(Param("Hello"), >>> Param("Ada"), >>> Param(12), >>> Param(3.14))); >> >> Hmm, but should the parameters and containers of be limited types? > > Probably not, but... > >> I find it rather natural to be able to copy parameter(s) > > ... I don't like to overengineer things in anticipation of usage > patterns that actually might never happen. I prefer to forbid it and > wait until it's asked for. But you used ":=", which was (no matter what RM says (:-)) a primitive operation undefined for limited types. Prior Ada 2005 it was, now, ":=" in declarations has a different meaning than in statements... > In C++ it's two lines of code or even half: > > class MyClass : boost::noncopyable > ... Huh, C++ has even weaker means to describe formal types contracts. It has dire . In Ada there is limited, tagged, range <> etc. Far too weak, IMO, but still better than C++. Anyway, there must be a reason why you wanted to have a compound parameters object rather than to specify them directly in the factory function. You didn't say what was the goal. To have an abstract factory? I have a suspicion that it wouldn't work anyway. BTW, you could try streams and getting the object directly from the stream instead. > > send them over IP... > > Then we're talking about serialization. Egh, no, serialization is ordering in time. To be able to copy is about lack of identity and memory-isotropy. > Limited types don't forbid it. Limited types is a kludge. There should be a simpler and clearer way to say that the thingy has no visible compiler-generated copy constructor, no equality, no aggregates, no assignment (in Ada 95). All these are just primitive operations or parts of. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de