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,c39ad3e35a7690a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.73.229 with SMTP id o5mr10736724pbv.7.1329166940627; Mon, 13 Feb 2012 13:02:20 -0800 (PST) Path: wr5ni21406pbc.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Convention for naming of packages Date: Mon, 13 Feb 2012 22:02:17 +0100 Organization: cbb software GmbH Message-ID: <1nsv5nr9t05qd$.4u7741n9thcp.dlg@40tude.net> References: <4f355230$0$21451$ba4acef3@reader.news.orange.fr> <1sx3fy79wys5s.1723nejowbg76.dlg@40tude.net> <15fgcngmgl41e$.113i7gtuwpwpv$.dlg@40tude.net> <12sbwz7m0r1qx.1pbp0ox3jr36s.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: trR2WuoGABtEWk7YPfvgdQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Date: 2012-02-13T22:02:17+01:00 List-Id: On Mon, 13 Feb 2012 19:10:41 +0100, Yannick Duchêne (Hibou57) wrote: > Le Mon, 13 Feb 2012 18:19:16 +0100, Dmitry A. Kazakov > a écrit: >> It is a quite uncommon use anyway. I mean to have a package of instances of >> some types. >> >> But certainly if that happens the instance always have meaningful names >> rather than "Object". E.g. >> >> package Units.Base is >> Current : constant Unit; >> Luminescence : constant Unit; >> Temperature : constant Unit; >> ... > This is a good example, but still not a singleton, That was an example of singleton values. > that's a specification, there is no need for an instantion here. This one for singleton objects: package Standard_IO is Input : File_Type; -- Assuming File_Type limited Output : File_Type; Error : File_Type; Here is an example for singleton type: task Scheduler is ... (Though singleton types are always suspicious for bad design) > About package holding singleton really holding singleton, like say a Log > package which would create a singleton file "Log.File" objct, I believe > that's not good for re‑usability (ex. what about multiple task?). Better > provide a type with a constructor, Constructor = constructor or constructor = constructing function? The latter is bad design. As for the example with log file, it is better not to expose it: package Logging is type Category is mod ...; Warning : constant Category; Error : constant Category; Info : constant Category; Any : constant Category; ... procedure Log (Event : Category; Text : String; Stamp : Time := Clock); ... end Logging; > What lacks for me here, is some paper with in deep talks about naming > convention in numerous ways. J-P provided one. He is one, whom opinion you can always trust (even if you disagree). >>> The semantic may be thin, if the semantic is thin, then its specification >>> cannot be said too much thin for the sole reason it's thin. >>> >>> Element_Type would be Element + Type, as you say, and also what appears as >>> the second parameter of an Add method. Its presence as the second >>> parameter of Add defines what Element_Type is (not just its name “Element” >>> and its Type status in the Ada source text). >> >> It is a language deficiency here, namely the generics. If the type of the >> class (of the container type) could be properly typed, you would not need >> to have meaningless names in meaningless packages the only purpose of >> which is meaningless instantiation. > I don't what kind of language construct you imagine, but I am pretty sure > these construct would requires dedicated keywords somewhere, some keywords > which would be the exact same as the names I am looking for. Class in T'Class is not a reserved word. Neither Unchecked_Access in X'Unchecked_Access is. Some Ada's reserved words were promoted for no good reason, but rather because of Ada 83 tradition. >> But even with generics, it is another deficiency that the element type (or >> the class of) cannot be asked from the container type it belongs to, as >> well as the type of the index and the type of sets of indices. > Seems you are wishing Introspection in Ada. Funny for someone who dislike > languages which provides it ;-) As I said it is a delicate balance. You can have it neither all nominal nor all inferred. > If a container type, named Container_Type can provide itself the type for > its index. How can you refer to it, if not via some expression, like > "Container_Type.Index_Type"? T'Index. Note that this is not an expression proper because in a statically typed language the algebra of types is separated from the core (object) language. The type and type-valued operations are not the first class citizens. Types in Ada have a meta language with rudimentary expressions of its own. Yes it should be extended a bit, but not too much. Otherwise you could lose the property of being statically typed. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de