comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Convention for naming of packages
Date: Fri, 10 Feb 2012 18:41:18 +0100
Date: 2012-02-10T18:41:18+01:00	[thread overview]
Message-ID: <op.v9g4q4awule2fv@douda-yannick> (raw)
In-Reply-To: 4f354f2c$0$6567$9b4e6d93@newsspool4.arcor-online.net

Le Fri, 10 Feb 2012 18:09:00 +0100, Georg Bauhaus  
<rm.dash-bauhaus@futureapps.de> a écrit:

> On 10.02.12 16:07, Yannick Duchêne (Hibou57) wrote:
>
>>    Object : constant Object_Type := Object (Param);
>
> (1) Does Object do anything? Does it, for example, make an object
> from Param? (2) Is there some kind of relationship between the
> function Object and its Param? (3) Is Object different from
> Object_Type--other than being a function, not a type?

No, it really returns an object and do nothing else (pure functions). I  
may be wrong with the choice of “Param” name. Better think of it as:

    Object : constant Object_Type := Object (Object_Of_Another_Type);

Object may returns/*be* an attribute (which may not really exist in the  
full view of the type if that's an opaque type) of its parameter(s). Some  
of these attributes may be kind of view. Thus, providing Instance_Type is  
defined, you may have things like:

    function Attribute_1 (Instance : Instance_Type) return Attribute_1_Type;
    function Attribute_2 (Instance : Instance_Type) return Attribute_2_Type;
    function View_1 (Instance : Instance_Type) return View_1_Type;
    function View_2 (Instance : Instance_Type) return View_2_Type;

For attributes, I though about something like a Get_ prefix, which is  
similar in some way to the Make_ prefix you suggest. But I want to avoid a  
prefix if possible. As I want a constant convention, this would mean using  
Get_ or Make_ everywhere. If I wanted to use Get_ only where conflict are  
likely to occurs, this would be weird and drafty (some function will have  
a Get_ prefixed, some others won't… not clean). Moreover, and as you later  
mentioned arrays, I would like to keep the ability to use the same  
convention for arrays and functions, as I see arrays as just a special  
kind of function and don't expect to emphases any distinction between  
arrays and functions. If ever the function was implemented with an array,  
which would be named Make_Something, this would be weird too.

Similarly, for views, I though about an As_ prefix. Being far less common  
and short while still correct english, this one could be OK and I don't  
mind for an As_ prefix. Having something like this would looks natural  
enough:

    View_Name : constant View_Name_Type := As_View_Name (Instance);

If a view may be seen as a special kind of attributes, the reversed is not  
true. I cannot name all attributes like this. So this would really be OK  
for views, and only views.

Function returning attributes, thus, accessors, are far more common. So a  
Get_ prefix would not be welcome. And this make it too much looks like an  
action, while the mentioned function are supposed to be pure.

For subprograms setting value, I don't mind to use a Set_ prefix  
everywhere, this looks natural, not bloating, and that's another story,  
there is no kind of conflict with object names here.


> When I imagine a function to be a table, the parameters and the
> result being the columns, I sometimes find a good name for
> the whole thing, in context.

What I want to avoid, is to think of a context which is too much specific  
and choose a name on that basis. That would mean the package specification  
may change each time an implementation create a context with conflicts.  
The package specification have to be designed with use case in mind, but  
should not be changed for each context which would occur later.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  reply	other threads:[~2012-02-10 17:41 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 21:10 Convention for naming of packages Yannick Duchêne (Hibou57)
2012-02-09 21:39 ` Jeffrey Carter
2012-02-10 15:07   ` Yannick Duchêne (Hibou57)
2012-02-10 17:04     ` Georg Bauhaus
2012-02-10 17:09     ` Georg Bauhaus
2012-02-10 17:41       ` Yannick Duchêne (Hibou57) [this message]
2012-02-13  9:33       ` Yannick Duchêne (Hibou57)
2012-02-11  0:56     ` Randy Brukardt
2012-02-13  3:09       ` BrianG
2012-02-10 17:21   ` Pascal Obry
2012-02-10 18:03     ` Yannick Duchêne (Hibou57)
2012-02-11  1:06     ` Randy Brukardt
2012-02-11  9:22       ` Simon Wright
2012-02-11 10:17         ` Yannick Duchêne (Hibou57)
2012-02-11 19:24           ` Yannick Duchêne (Hibou57)
2012-02-11 20:06             ` Simon Wright
2012-02-12  9:18               ` Yannick Duchêne (Hibou57)
2012-02-12 10:22                 ` Simon Wright
2012-02-13  9:21         ` Yannick Duchêne (Hibou57)
2012-02-12 19:53       ` J-P. Rosen
2012-02-12 21:19         ` Yannick Duchêne (Hibou57)
2012-02-13  8:53           ` Dmitry A. Kazakov
2012-02-13  9:12             ` Yannick Duchêne (Hibou57)
2012-02-13 11:03               ` Dmitry A. Kazakov
2012-02-13 11:57                 ` Yannick Duchêne (Hibou57)
2012-02-13 12:30                   ` Yannick Duchêne (Hibou57)
2012-02-13 13:07                     ` Dmitry A. Kazakov
2012-02-13 14:01                       ` Yannick Duchêne (Hibou57)
2012-02-13 14:59                         ` Dmitry A. Kazakov
2012-02-13 15:05                           ` Yannick Duchêne (Hibou57)
2012-02-13 15:23                             ` Dmitry A. Kazakov
2012-02-14 21:02                               ` Yannick Duchêne (Hibou57)
2012-02-13 13:01                   ` Dmitry A. Kazakov
2012-02-13 13:04                     ` Yannick Duchêne (Hibou57)
2012-02-13 13:19                       ` Dmitry A. Kazakov
2012-02-13 14:20                         ` Yannick Duchêne (Hibou57)
2012-02-13 15:11                           ` Dmitry A. Kazakov
2012-02-13 16:24                             ` Yannick Duchêne (Hibou57)
2012-02-13 17:19                               ` Dmitry A. Kazakov
2012-02-13 18:10                                 ` Yannick Duchêne (Hibou57)
2012-02-13 21:02                                   ` Dmitry A. Kazakov
2012-02-14  9:08                                     ` Yannick Duchêne (Hibou57)
2012-02-14 13:33                                       ` Dmitry A. Kazakov
2012-02-14 14:40                                         ` Yannick Duchêne (Hibou57)
2012-02-14 15:26                                           ` Dmitry A. Kazakov
2012-02-13 10:45             ` Georg Bauhaus
2012-02-13 10:59               ` Yannick Duchêne (Hibou57)
2012-02-14 10:18           ` Yannick Duchêne (Hibou57)
2012-02-14 11:51             ` Yannick Duchêne (Hibou57)
2012-02-14 22:21               ` Manuel Collado
2012-02-15  4:09                 ` Simon Wright
2012-02-15  6:13                   ` Niklas Holsti
2012-02-15 11:26                     ` Yannick Duchêne (Hibou57)
2012-02-15 11:39                     ` Georg Bauhaus
2012-02-15 11:47                       ` Georg Bauhaus
2012-02-15  6:30                   ` J-P. Rosen
2012-02-15  8:36                     ` Simon Wright
2012-02-15 22:56                     ` Robert A Duff
2012-02-15 11:27                   ` Yannick Duchêne (Hibou57)
2012-02-15 11:43                     ` Georg Bauhaus
2012-02-15 12:33                       ` Georg Bauhaus
2012-02-15 12:55                         ` Yannick Duchêne (Hibou57)
2012-02-15 17:30                           ` Georg Bauhaus
2012-02-09 22:33 ` Simon Wright
2012-02-09 22:35 ` J-P. Rosen
2012-02-10 14:38   ` Yannick Duchêne (Hibou57)
2012-02-10  9:47 ` Mart van de Wege
2012-02-10 14:24   ` Yannick Duchêne (Hibou57)
2012-02-13  3:02     ` BrianG
2012-02-10 12:19 ` Brian Drummond
2012-02-10 14:22   ` Yannick Duchêne (Hibou57)
2012-02-10 19:16   ` Jeffrey Carter
2012-02-11 16:31 ` Martin Dowie
2012-02-16 17:44 ` Convention for naming of anything Yannick Duchêne (Hibou57)
2012-02-17 19:46   ` Yannick Duchêne (Hibou57)
2012-02-17 21:53     ` Manuel Collado
2012-02-17 22:12       ` Yannick Duchêne (Hibou57)
2012-02-17 23:52   ` Adam Beneschan
2012-02-18  0:24     ` Yannick Duchêne (Hibou57)
2012-02-18  0:50       ` Yannick Duchêne (Hibou57)
2012-02-18 22:53         ` BrianG
2012-02-19 11:16           ` Simon Wright
2012-03-06  0:36             ` Randy Brukardt
2012-02-18 11:32   ` Georg Bauhaus
2012-02-18 13:02     ` Yannick Duchêne (Hibou57)
2012-02-19 18:07   ` Phil Clayton
2012-02-19 21:53     ` Yannick Duchêne (Hibou57)
2012-02-20  0:21       ` Phil Clayton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox