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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,25d835bb9a4a003f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Types, packages & objects : the good old naming conventions question (without religious ware) References: <4ae9dade$0$6551$9b4e6d93@newsspool4.arcor-online.net> <4aef3911$0$7617$9b4e6d93@newsspool1.arcor-online.net> <4af2ba89$0$6566$9b4e6d93@newsspool4.arcor-online.net> <4af42f5b$0$7624$9b4e6d93@newsspool1.arcor-online.net> From: Stephen Leake Date: Sat, 07 Nov 2009 00:49:59 -0500 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:kk9WoQ4/dCzbKjZFY3mDg9tgidg= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 7d6214af50a67e197caa702798 Xref: g2news2.google.com comp.lang.ada:9021 Date: 2009-11-07T00:49:59-05:00 List-Id: Georg Bauhaus writes: > On 11/6/09 11:14 AM, Stephen Leake wrote: > >>> second, a rule that forces programmers to use a prefix in clients, >>> to make sure the type of "Container" can be seen immediately: >>> >>> procedure Some_Client >>> ( : List.Container; ...); >>> >>> Left_Queue, Right_Queue : List.Container; >> >> What if the problem domain is "any list"? We keep pointing this out, >> people keep ignoring it. > > > procedure Some_Client (Any_List : List.Container; ...); > procedure Some_Client (Any_List : List; ...); > procedure Some_Client (Any_List : Sequence; ...); > > > This is what I meant by hinting to the domain. Surely these are in different packages? Packages Containers, Lists, and Sequences? Then it is the package name that gives the domain; that works for me. > At least, "Any", unlike "_Type" is not from the Ada language > vocabulary. One reason to use "_Type" is precisely _because_ it means "Ada type"; there's no need to wonder about what it means. >>>>> Cf. valid Eiffel: >>>>> >>>>> local >>>>> string: STRING >>>>> do >>>>> ... -- more uses of string and STRING. Or StrINg. >> Ah; Eiffel has separate type and object name >> spaces. So I don't understand the original example; what was the >> point? > > In a dozen or so lines of subprogram text, the sequence of > characters "String" can refer to two different concepts, in Eiffel, > when you have declared string : STRING, an object and a type. So the case is not important; why did you introduce it? In another post, someone said Eiffel required <> around types; is that not true? > The reader, on seeing "String" in the lines following the > declaration, is forced to infer from context which concept was > meant. Sure, this is possible, not even difficult if you know the > language, as every Eiffel compiler demonstrates. When designing naming conventions, I always assume you know the language. In a language like C, sometimes we use conventions that are not strictly necessary, because the syntax is so bad. I have not used Eiffel, but if I assume the syntax distinguishing type from object is as good as in Ada, then I don't see a problem here. > But I don't want to assume the role of the compiler just to see what > "String" stands for. This is name overloading of two language > concepts in the very same inner scope. Even when this if formally > just fine, what's the point? The point, as always in this discussion, is to save time making up separate names for types and objects. >> Yes, this is an example of name overloading. Overloading, like any >> good thing, can be abused. > > Assuming separate namespaces for objects and types, > I can imagine programmers who find "string : STRING" > very clever. Or just a good match for some twisted programming > trick. Why make cleverness, or the appearance thereof, > easy to achieve? Good programmers will just find it natural; why introduce twisted programmers into this? -- -- Stephe