* Idiomatic formatting for empty package @ 2017-10-04 21:36 Victor Porton 2017-10-04 22:10 ` Victor Porton ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Victor Porton @ 2017-10-04 21:36 UTC (permalink / raw) What is more idiomatic? package X is end X; or package X is end X; -- Victor Porton - http://portonvictor.org ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-04 21:36 Idiomatic formatting for empty package Victor Porton @ 2017-10-04 22:10 ` Victor Porton 2017-10-05 5:27 ` Re : " Pascal Obry 2017-10-05 23:36 ` Randy Brukardt 2017-10-05 23:49 ` andrewshvets 2 siblings, 1 reply; 17+ messages in thread From: Victor Porton @ 2017-10-04 22:10 UTC (permalink / raw) Victor Porton wrote: > What is more idiomatic? > > package X is > end X; > > or > > package X is > > end X; Hm, or is it the following? package X is pragma Pure(X); end X; -- Victor Porton - http://portonvictor.org ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re : Idiomatic formatting for empty package 2017-10-04 22:10 ` Victor Porton @ 2017-10-05 5:27 ` Pascal Obry 2017-10-05 18:10 ` marciant 0 siblings, 1 reply; 17+ messages in thread From: Pascal Obry @ 2017-10-05 5:27 UTC (permalink / raw) Le jeudi 05 octobre 2017 à 01:10 +0300, Victor Porton a écrit : > Victor Porton wrote: > > > What is more idiomatic? > > > > package X is > > end X; > > > > or > > > > package X is > > > > end X; > > Hm, or is it the following? > > package X is > pragma Pure(X); > end X; Or: package X with Pure is end X; -- Pascal Obry / Magny Les Hameaux (78) The best way to travel is by means of imagination http://www.obry.net gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Re : Idiomatic formatting for empty package 2017-10-05 5:27 ` Re : " Pascal Obry @ 2017-10-05 18:10 ` marciant 2017-10-05 23:37 ` Randy Brukardt 0 siblings, 1 reply; 17+ messages in thread From: marciant @ 2017-10-05 18:10 UTC (permalink / raw) Or: package X with Pure is end; Vin ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-05 18:10 ` marciant @ 2017-10-05 23:37 ` Randy Brukardt 2017-10-06 20:04 ` marciant 0 siblings, 1 reply; 17+ messages in thread From: Randy Brukardt @ 2017-10-05 23:37 UTC (permalink / raw) <marciant@earthlink.net> wrote in message news:4b8654b4-e479-4b37-b9ec-dba2a03c7276@googlegroups.com... > Or: > > package X with Pure is end; FYI, John Barnes hates this form. Best to put the end on a line by itself. Randy. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-05 23:37 ` Randy Brukardt @ 2017-10-06 20:04 ` marciant 2017-10-07 1:55 ` Randy Brukardt 0 siblings, 1 reply; 17+ messages in thread From: marciant @ 2017-10-06 20:04 UTC (permalink / raw) On Thursday, October 5, 2017 at 7:37:54 PM UTC-4, Randy Brukardt wrote: > > Or: > > > > package X with Pure is end; > > FYI, John Barnes hates this form. Best to put the end on a line by itself. > > Randy. If it is being used as the "root" of a hierarchy that has both visible and private children - possibly the answer to you question in a different post - then it probably is the only code in a file that just has comments/documentation. If so, it seems useless to me to have to have a line break and repeat the name in that case. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-06 20:04 ` marciant @ 2017-10-07 1:55 ` Randy Brukardt 0 siblings, 0 replies; 17+ messages in thread From: Randy Brukardt @ 2017-10-07 1:55 UTC (permalink / raw) marciant@earthlink.net> wrote in message news:7eac50d1-33d2-4872-9a3f-a438394b654f@googlegroups.com... On Thursday, October 5, 2017 at 7:37:54 PM UTC-4, Randy Brukardt wrote: > > Or: > > > > package X with Pure is end; > > FYI, John Barnes hates this form. Best to put the end on a line by itself. >If it is being used as the "root" of a hierarchy that has both visible and >private >children - possibly the answer to you question in a different post - then >it >probably is the only code in a file that just has comments/documentation. >If >so, it seems useless to me to have to have a line break and repeat the name >in that case. I prefer consistency to special-case rules. Ergo, I *always* repeat the name if the language allows that. (I probably wouldn't use the task shorthand, either.) YMMV. In any case, I just read a new rant from John about "is end" at the end of empty packages. You best not have him as one of your code reviewers. ;-) Randy. Randy. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-04 21:36 Idiomatic formatting for empty package Victor Porton 2017-10-04 22:10 ` Victor Porton @ 2017-10-05 23:36 ` Randy Brukardt 2017-10-06 8:47 ` Jeffrey R. Carter 2017-10-05 23:49 ` andrewshvets 2 siblings, 1 reply; 17+ messages in thread From: Randy Brukardt @ 2017-10-05 23:36 UTC (permalink / raw) Out of curosity, why you do need to write an empty package? I don't think I've encountered one outside of ACATS tests and incomplete examples. For a package whose contents are TBD, I would document that fact with a comment (thus the package would not appear empty): package MT is -- %%% Temp: TBD declarations to go here. end MT; (Note: The "%%% Temp" is a convention that I use so I can check easily that all of the incomplete code places have been finished before I start testing.) Randy. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-05 23:36 ` Randy Brukardt @ 2017-10-06 8:47 ` Jeffrey R. Carter 2017-10-07 1:52 ` Randy Brukardt 0 siblings, 1 reply; 17+ messages in thread From: Jeffrey R. Carter @ 2017-10-06 8:47 UTC (permalink / raw) On 10/06/2017 01:36 AM, Randy Brukardt wrote: > Out of curosity, why you do need to write an empty package? I don't think > I've encountered one outside of ACATS tests and incomplete examples. I frequently structure projects as package Project is pragma Pure; end Project; package Project.Model is ... package Project.UI is ... procedure Project.Program is ... -- Jeff Carter "This school was here before you came, and it'll be here before you go." Horse Feathers 48 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-06 8:47 ` Jeffrey R. Carter @ 2017-10-07 1:52 ` Randy Brukardt 2017-10-07 6:55 ` Jeffrey R. Carter 0 siblings, 1 reply; 17+ messages in thread From: Randy Brukardt @ 2017-10-07 1:52 UTC (permalink / raw) "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message news:or7fu4$7vh$1@dont-email.me... > On 10/06/2017 01:36 AM, Randy Brukardt wrote: >> Out of curosity, why you do need to write an empty package? I don't think >> I've encountered one outside of ACATS tests and incomplete examples. > > I frequently structure projects as > > package Project is > pragma Pure; > end Project; > > package Project.Model is ... > package Project.UI is ... > procedure Project.Program is ... Sure, but there always seems to be something that needs to be shared amongst all of the parts. So the root package never ends up completely empty. For instance, see Ada.Strings or Ada.Containers. Randy. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-07 1:52 ` Randy Brukardt @ 2017-10-07 6:55 ` Jeffrey R. Carter 2017-10-09 21:45 ` Randy Brukardt 0 siblings, 1 reply; 17+ messages in thread From: Jeffrey R. Carter @ 2017-10-07 6:55 UTC (permalink / raw) On 10/07/2017 03:52 AM, Randy Brukardt wrote: > > Sure, but there always seems to be something that needs to be shared amongst > all of the parts. So the root package never ends up completely empty. For > instance, see Ada.Strings or Ada.Containers. For instance, see package Ada. -- Jeff Carter "I did not rob a bank. If I'd robbed a bank, everything would be great. I tried to rob a bank, is what happened, and they got me." Take the Money and Run 139 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-07 6:55 ` Jeffrey R. Carter @ 2017-10-09 21:45 ` Randy Brukardt 2017-10-10 7:12 ` Jeffrey R. Carter 0 siblings, 1 reply; 17+ messages in thread From: Randy Brukardt @ 2017-10-09 21:45 UTC (permalink / raw) "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message news:or9too$93i$1@dont-email.me... > On 10/07/2017 03:52 AM, Randy Brukardt wrote: >> >> Sure, but there always seems to be something that needs to be shared >> amongst >> all of the parts. So the root package never ends up completely empty. For >> instance, see Ada.Strings or Ada.Containers. > > For instance, see package Ada. John also pointed this out privately. Sorry that I missed it. Still, Ada is not a very good example: (1) Ada was created after the fact to group a bunch of unrelated packages together. One hopes that no one thinks that such a practice is a good idea! The grouping should be of things that are related (like Ada.Strings and Ada.Containers), and aas I noted, typically there are things that are shared that make sense in the root package. (2) For instance, had the IO packages been grouped together (without all of the other unrelated stuff), it would make sense for the IO exceptions to be declared in that parent package. It wasn't done in Ada as the organization of the IO libraries predates child packages. (Argubly, that should have been done anyway in Ada 95, but it's not as obvious given the capabiliy needs.) So, I still don't see much need for empty packages; the existence of one poorly designed example doesn't change that. Randy. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-09 21:45 ` Randy Brukardt @ 2017-10-10 7:12 ` Jeffrey R. Carter 2017-10-10 10:21 ` AdaMagica 0 siblings, 1 reply; 17+ messages in thread From: Jeffrey R. Carter @ 2017-10-10 7:12 UTC (permalink / raw) On 10/09/2017 11:45 PM, Randy Brukardt wrote: > "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message >> >> For instance, see package Ada. > > John also pointed this out privately. Sorry that I missed it. Still, Ada is > not a very good example: > > (1) Ada was created after the fact to group a bunch of unrelated packages > together. One hopes that no one thinks that such a practice is a good idea! > The grouping should be of things that are related (like Ada.Strings and > Ada.Containers), and aas I noted, typically there are things that are shared > that make sense in the root package. > > (2) For instance, had the IO packages been grouped together (without all of > the other unrelated stuff), it would make sense for the IO exceptions to be > declared in that parent package. It wasn't done in Ada as the organization > of the IO libraries predates child packages. (Argubly, that should have been > done anyway in Ada 95, but it's not as obvious given the capabiliy needs.) I agree with most of what you say. I think the purpose of Ada was namespace control: Where before we had a bunch of pkgs using up names we might want to use, after we had a single hierarchy under Ada. (Of course, the Ada-83 compatibility renamings undo that.) My project naming convention is similar: Everything in project Project has a name beginning with Project. Usually there are no common declarations that would go in the parent pkg. My real reason for bringing up pkg Ada was as something for the OP's consideration. As an empty pkg spec in the ARM, it might be considered the idiomatic formatting for same. -- Jeff Carter "[I]f we should ever separate, my little plum, I want to give you one little bit of fatherly advice. ... Never give a sucker an even break." Poppy 97 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-10 7:12 ` Jeffrey R. Carter @ 2017-10-10 10:21 ` AdaMagica 2017-10-10 14:34 ` Jeffrey R. Carter 0 siblings, 1 reply; 17+ messages in thread From: AdaMagica @ 2017-10-10 10:21 UTC (permalink / raw) Am Dienstag, 10. Oktober 2017 09:12:23 UTC+2 schrieb Jeffrey R. Carter: > ... I think the purpose of Ada was namespace > control: Where before we had a bunch of pkgs using up names we might want to > use, after we had a single hierarchy under Ada. (Of course, the Ada-83 > compatibility renamings undo that.) ... But those renamings don't clutter the user's namespace since the names may be used for user-created packages: RM J.1(10), AARM A.2(4.a). ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-10 10:21 ` AdaMagica @ 2017-10-10 14:34 ` Jeffrey R. Carter 2017-10-10 17:38 ` AdaMagica 0 siblings, 1 reply; 17+ messages in thread From: Jeffrey R. Carter @ 2017-10-10 14:34 UTC (permalink / raw) On 10/10/2017 12:21 PM, AdaMagica wrote: > Am Dienstag, 10. Oktober 2017 09:12:23 UTC+2 schrieb Jeffrey R. Carter: >> ... I think the purpose of Ada was namespace control: Where before we had a >> bunch of pkgs using up names we might want to use, after we had a single >> hierarchy under Ada. (Of course, the Ada-83 compatibility renamings undo >> that.) ... > > But those renamings don't clutter the user's namespace since the names may be > used for user-created packages: RM J.1(10), AARM A.2(4.a). Yes, but I'd never use those names, since they'd confuse the reader, who would reasonably assume they were the renamings. So they're still effectively off limits. -- Jeff Carter "Nobody expects the Spanish Inquisition!" Monty Python's Flying Circus 22 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-10 14:34 ` Jeffrey R. Carter @ 2017-10-10 17:38 ` AdaMagica 0 siblings, 0 replies; 17+ messages in thread From: AdaMagica @ 2017-10-10 17:38 UTC (permalink / raw) Am Dienstag, 10. Oktober 2017 16:34:51 UTC+2 schrieb Jeffrey R. Carter: > On 10/10/2017 12:21 PM, AdaMagica wrote: > > But those renamings don't clutter the user's namespace since the names may be > > used for user-created packages: RM J.1(10), AARM A.2(4.a). > > Yes, but I'd never use those names, since they'd confuse the reader, who would > reasonably assume they were the renamings. So they're still effectively off limits. Ha! This facility once redounded to my advantage when rehosting airborne Ada 83 code for a full scale flight simulator in Ada 95. Package Calendar had to be replaced by a simulated time calendar. Rather than searching the millions of lines of code and exchanging Calender by Sim_Calendar, I only had to declare package Calendar renames Sim_Calendar; (I know I was lucky because the airborne code used Ada 83 and I could use newer Ada generations.) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Idiomatic formatting for empty package 2017-10-04 21:36 Idiomatic formatting for empty package Victor Porton 2017-10-04 22:10 ` Victor Porton 2017-10-05 23:36 ` Randy Brukardt @ 2017-10-05 23:49 ` andrewshvets 2 siblings, 0 replies; 17+ messages in thread From: andrewshvets @ 2017-10-05 23:49 UTC (permalink / raw) On Wednesday, October 4, 2017 at 5:36:42 PM UTC-4, Victor Porton wrote: > What is more idiomatic? > > package X is > end X; > > or > > package X is > > end X; > > -- > Victor Porton - http://portonvictor.org It would depend on personal taste. I honestly don't see a difference between the two. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-10-10 17:38 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-04 21:36 Idiomatic formatting for empty package Victor Porton 2017-10-04 22:10 ` Victor Porton 2017-10-05 5:27 ` Re : " Pascal Obry 2017-10-05 18:10 ` marciant 2017-10-05 23:37 ` Randy Brukardt 2017-10-06 20:04 ` marciant 2017-10-07 1:55 ` Randy Brukardt 2017-10-05 23:36 ` Randy Brukardt 2017-10-06 8:47 ` Jeffrey R. Carter 2017-10-07 1:52 ` Randy Brukardt 2017-10-07 6:55 ` Jeffrey R. Carter 2017-10-09 21:45 ` Randy Brukardt 2017-10-10 7:12 ` Jeffrey R. Carter 2017-10-10 10:21 ` AdaMagica 2017-10-10 14:34 ` Jeffrey R. Carter 2017-10-10 17:38 ` AdaMagica 2017-10-05 23:49 ` andrewshvets
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox