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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.7.1 with SMTP id f1mr8992117itf.0.1513518467052; Sun, 17 Dec 2017 05:47:47 -0800 (PST) X-Received: by 10.157.46.130 with SMTP id w2mr203550ota.10.1513518466925; Sun, 17 Dec 2017 05:47:46 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!i6no574678itb.0!news-out.google.com!b73ni2257ita.0!nntp.google.com!i6no574677itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 17 Dec 2017 05:47:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> <3df6404a-588d-4e2d-a189-1d1e32ce9f5d@googlegroups.com> <73b4a9bd-1f3b-42b9-9ef7-5303b0a88794@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <427478f8-298f-49b3-9cc1-4cfd58da6bd4@googlegroups.com> Subject: Prefixed notation for non tagged types From: Jere Injection-Date: Sun, 17 Dec 2017 13:47:47 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49496 Date: 2017-12-17T05:47:46-08:00 List-Id: On Monday, July 3, 2017 at 10:18:33 PM UTC-4, Randy Brukardt wrote: > "Jere" wrote in message > > On Sunday, July 2, 2017 at 8:04:56 PM UTC-4, Randy Brukardt wrote: > >> (3) Since prefixed notation does automatic dereferencing and referencing > >> (that is, .all and 'Access), allowing it on all types caused levels of > >> ambiguity (and potentially infinite regress). It was easier to just > >> define > >> it on tagged types, which didn't have those issues. Perhaps it could have > >> been made to work, but it was more work for a feature that already had > >> significant opposition; probably it would have been dropped rather than > >> getting more complicated. (Sound like a broken record??) > > > > Was there any consideration to having prefixed notation to > > apply to all record types and add a way to denote that a private > > type is a record type (there should be many ways to do that)? > > We don't really need it on all types, just record types. > > Not that I recall, but requiring an indication that a private type is > completed by a record seems like noise (99% of private types are completed > by some sort of record as it is). It would be better the other way around > (indicate when it is *not* completed by a record), but of course that would > be incompatible. Still seems best for Ada'Succ. > > Randy. I know this is an old email chain, but I've been thinking about this more recently. For background, I asked if there could be a way to denote that a private type was a record type, so that Prefixed notation could be used on non tagged types. Randy noted that since most private types were record types, it would just be noise. I wanted to revisit this thought. Forgive me if there is a good way to split the chain. I don't know how to do that. So with that in mind: My inclination is that the noise is already there. I generally like prefixed notation (it is easier for me to discern what is going on when I read it), so even though I don't really like providing extension for a type, I find myself making types tagged just to get the prefixed notation. In essence, I am already adding noise. I think my suggestion is that the noise could be replaced. Instead of having to mark any type where I want that notation (I don't do it to all types) as tagged, have some other method that allows for the ada compiler to confirm the full view is a record but also allow for the prefixed notation in partial public view. I like to keep extension out of many types that I wante prefixed notation on. I don't want the baggage that tagged types come with unless I am actually utilizing those features. I'm sure there are a ton of ways to do this: 1. use the not keyword in conjunction with tagged: type My_Type is not tagged limited private; I don't like this at all but just saying it is an option. I think it conveys a confusing meaning to the type. 2. new keyword type My_Type is limited private; I don't really like adding new keywords either...though the option is there I guess. Something like the "final" keyword that says it was tagged but can no longer be extended or some keyword completely unrelated to tagged-ness. 3. change up record declarations to use "record" in the partial view: type My_Type is limited private record; My guess is this would be difficult for compiler writers though as record is used for starting a declaration block. 4. maybe an aspect type My_Type is limited private with Prefixed_Notation => True; -- or some other aspect name Here I am unsure if this is a good fit or not. I don't have a good feel for the boundaries of what aspects should be used for. 5. maybe an attribute type My_Type is limited private; for My_Type'Prefixed_Notation use True; -- or some other name Same thoughts as #4 but I feel even more strongly that this would be odd. Maybe some other options. My key point is that there already exists noise out there for this and it comes with features that the designer may not want to expose in the process. Maybe there is a better way to handle it. I realize that if the feature existed others that didn't mark types tagged for prefix notation would possibly use it, but I think that is more of an indication of why it should be explored further. Anyone have any thoughts?