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,1a52c822fc0dbb23 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Rational for not making cursor tagged in Containers 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: <1176998738.656903.141250@q75g2000hsh.googlegroups.com> <1177010938.200523.325290@p77g2000hsh.googlegroups.com> <1a8y2vakorfhx.225uqh4hifpd$.dlg@40tude.net> <1xmzi7newnilp.23m3zze8h9yi.dlg@40tude.net> <1177066583.5876.30.camel@localhost.localdomain> Date: Fri, 20 Apr 2007 12:39:13 +0200 Message-ID: NNTP-Posting-Date: 20 Apr 2007 12:39:13 CEST NNTP-Posting-Host: 11351a9e.newsspool2.arcor-online.net X-Trace: DXC=bn0dn8`=G[HWDmlTRbh@=IA9EHlD;3YcB4Fo<]lROoRA8kFOhY@\IAC?VYL X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15145 Date: 2007-04-20T12:39:13+02:00 List-Id: On Fri, 20 Apr 2007 12:56:23 +0200, Georg Bauhaus wrote: > On Fri, 2007-04-20 at 09:54 +0200, Dmitry A. Kazakov wrote: > >> In a better language any type could be able implement record interface: >> >> type Foo is interface record -- This not an implementation! >> Mumble : Integer; >> end record; >> private >> type Foo is new Float; -- Implements the record interface >> function "Mumble" (X : Foo) return Integer; -- Getter >> procedure "Mumble" (X : in out Foo; Value : Integer); -- Setter > > C# and Eiffel do it this way; I'm almost sure there is a bunch of > Lisp macros achieving the same. But I think approaching simple records > like this will be a huge mistake in a language like Ada, for the > following reason: When a user of your type see the above definition > > type Foo is interface record ... > > it means that he or she will *have* to look at the implementation > (or hope for extensive documentation): There is no > way of knowing whether reading or writing a record component will > just move some bits, or try to compute the first prime number of > the 1969 lottery on the way. And you claim to know it. Always? With all possible pragmas applied, including Pack, as well as representation clauses like for X'Address use ...? As for me, I don't know it in 90% cases, and in 99% of these, I just don't care. Ada is known a safe language (tm), which assumes not only safe primitives but also a safe composition of. BTW, Ada has private types from the day one. > And, considering Controlled, forcing *all* types to be derived > from this base suffers from the same effects for the same reason. Because multiple-inheritance is *the* answer. You need not to force anybody to anything if an interface (and an implementation of) can be added later. There indeed exist very hard interfaces to add later, like the task interface or the protected interface. But more things you have hard-wired in the language, more complex it becomes for everybody, you, me, the compiler vendor and the Pentium. > Not every programming team consists of real or even wannabe > language designers. But who else has even got a chance of knowing > what they are doing to a larger program when implementing the > concept of record? Why they are allowed to implement a concept of task, but not one of getter and setter? Where do you draw the line? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de