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,dad94612ff745427 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Instantiating private types with discriminants? 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: <1147252198.138173.203910@j73g2000cwa.googlegroups.com> <44623869$0$4504$9b4e6d93@newsread2.arcor-online.net> <87d5elk8e9.fsf@ludovic-brenta.org> <13byov3p0dqhk.yglz3nh5rpb8$.dlg@40tude.net> Date: Fri, 12 May 2006 09:37:20 +0200 Message-ID: <2l9uhyhkrquy.1rbhnqk1k2u52$.dlg@40tude.net> NNTP-Posting-Date: 12 May 2006 09:37:21 MEST NNTP-Posting-Host: 5c81841f.newsread2.arcor-online.net X-Trace: DXC=j@LSH9U6MJD^a1SS:=Ik]JQ5U85hF6f;DjW\KbG]kaMHVA=iV<7g:2E8k=I=NSeHhKWRXZ37ga[7Jn919Q4_`VjINZZj5LgkU On 11 May 2006 11:59:37 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: >> You don't need "all" here: >> >> Iterator := Iterator.Next; >> >> Ada's pointers are transparent to record member/discriminant and array >> element (indexing) access. > > Syntactically transparent, but not semantically. If the ".all" syntax > weren't so darn ugly, I would recommend always using an explicit > dereference. I believe there's an option in GNAT (a Restriction > pragma?) that allows you to force yourself to always say ".all", > which might not be a bad idea. I beg to disagree. Semantic difference you are talking about is not always the problem space's one. It is often just a language artefact. In my view, exactly the opposite should be done, i.e. removing all traces of "all". (:-)) A user-defined pointer (referential) type should (IMO) be considered a subtype, that inherits all operations of the target type. If assignment gets overridden (to have shallow copy semantics), that does not automatically imply anything for other operations. Also, a good design should have as a goal preventing visibility of both the target type if its referential counterpart in client contexts. So if references are needed then the target type should be private. That would exclude any misunderstandings about semantics of a given operation. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de