Georg Bauhaus wrote: > AdaMagica schrieb: >> On 29 Okt., 13:21, Hibou57 (Yannick Duchêne) >> <yannick_duch...@yahoo.fr> wrote: >>> On 28 oct, 20:12, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
>>>> "Hibou57 (Yannick Duchêne)" <yannick_duch...@yahoo.fr> wrote in messagenews:b6d32b60-333f-495d-> By jove, I think he's got it! :-) >>> What does mean “ By Jove ” ? (I'm not native English, sorry). >> By Jupiter
>> Latin Jupiter Nom., Jovis Gen., Jovi Dat. ...
> Maybe Randy was referring to My Fair Lady? (The next Ada > Europe conference is taking place in València in Spain, so ...)
Wasn't that "By George"?
-- Jeff Carter "C's solution to this [variable-sized array parameters] has real problems, and people who are complaining about safety definitely have a point." Dennis Ritchie 25
> Georg Bauhaus wrote: >> AdaMagica schrieb: >>> On 29 Okt., 13:21, Hibou57 (Yannick Duchêne) >>> <yannick_duch...@yahoo.fr> wrote: >>>> On 28 oct, 20:12, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
>>>>> "Hibou57 (Yannick Duchêne)" <yannick_duch...@yahoo.fr> wrote in >>>>> messagenews:b6d32b60-333f-495d-> By jove, I think he's got it! :-) >>>> What does mean “ By Jove ” ? (I'm not native English, sorry). >>> By Jupiter
>>> Latin Jupiter Nom., Jovis Gen., Jovi Dat. ...
>> Maybe Randy was referring to My Fair Lady? (The next Ada >> Europe conference is taking place in València in Spain, so ...)
> Wasn't that "By George"?
Yes, the second interjection starts with those words. I found one "By Jove!" in Pygmalion. (It is Pickering's expression when he sees Liza dressed like a lady for the first time. Ada is a lady's name, too...) "I think she's got it" is the first interjection in the song, "By George, she's got it" the second. I'm not familiar with permissions to refer to deities in theaters of the time (or in comp.lang.ada), so I was assuming some such was meant.
>I do not mean you comment is wrong, I just attempt to reply and >advocate an view on the situation.
>If I'm surely wrong on the long time, I want to know before I discover >it myself after a (too much) long time
I don't have time to give you a detailed reply, sorry. (Well, not unless you want to hire me for consulting. :-)
Let me just give my general thinking on this subject. I think formal packages should be used sparingly, in part because they complicate the use of a generic package (the more instances and parameters that you have write before anything useful can be done, the harder it is to understand and the more likely that you will just forget using the generic and "roll your own").
Typically, when I've had to compose generics, I will nest an instantiation of one inside the other. (That's pretty much all you could do in Ada 83, after all.) Most of the time, that works fine, and the operations in the instance can be used directly or re-exported with renames as needed.
I also would have to agree with Dmitry (at least to a point) that generics can really interfere with your designs, so you need to use them sparingly. You can't avoid them completely when designing something like containers (for instance), but note that we made a strong effort to preserve the "single instance" model in almost all of the language-defined generics. We did that even at the cost of being able to have container interfaces (which would be really nice for abstraction purposes, but would require a second level of generic instances in order to be useful).
> I don't think we should much care about backward compatibility with regard > to generics.
Well, I doubt that would be very popular with anyone that has existing Ada code that they want to use with the latest version of the language.
As Robert Dewar says, incompatibilities have a very high bar. There has to be real and compelling value for an incompatibility. I don't see that in this case that that it not clear that the revised situation is really better than the current one -- it's mostly a sideways move.
> My take is that any generic code is potentially broken. Anyone who uses > generics beyond very trivial cases should know that, and mentally prepare > himself to fix his code over and over again.
That's pretty cynical. Most of time, once you get your generic working, you hardly every touch it again. Besides, you could make the above statement for almost any Ada (or other programming language) code when it is reused.
On 29 oct, 23:56, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> I don't have time to give you a detailed reply, sorry. (Well, not unless you > want to hire me for consulting. :-)
Don't mind about time, I can understand If could ask you for consulting, I enjoy to do, but unluckily, I'm jobless, ... so ... any I feel honored you've take some time to answer ;)
> Typically, when I've had to compose generics, I will nest an instantiation > of one inside the other. (That's pretty much all you could do in Ada 83, > after all.) Most of the time, that works fine, and the operations in the > instance can be used directly or re-exported with renames as needed.
I was thinking about such a thing, it was planned, but I still not tried it, because I was busy at thinking about what the best naming conventions are (another topic).
> That's pretty cynical. Most of time, once you get your generic working, > you hardly every touch it again. Besides, you could make the above > statement for almost any Ada (or other programming language) code > when it is reused.
I also feel better after that, the assertion you replied to with these words, was also a bit frightening to me (I was thinking it was a bit too much, but was not sure after all, as I know there are probably a lot of things I do not know).
On 28 oct, 20:12, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> By jove, I think he's got it! :-)
> The above reasoning makes sense, and it actually seems to reflect the > supposed rationale. It would be nice if a fuller example of this was > included somewhere. (I'd put it into the AARM if I had any idea of where it > should go.)
> Randy.
While a remaining point would not look so much nice in a rational : the name trouble. OK, it's nice the language hides by default and it's not a trouble because one may show if he/she want. That said, in Ada, everything must have a name ( ;) ) and I do not see a good rational which could give any good reason about the fact that “ if you want to make it visible, you must trick the name ”, moreover that good naming is an important part of Ada programs.
The point is then not about the possibility to hide or the possibility to show (that is solved), and rather about the required trick on the name.
I leave this one point to interested peoples, without me (because I know it is a language fact and nothing could be able to change this).
On Thu, 29 Oct 2009 18:03:02 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote in message > news:1kf8mo4r9lqxg.1tdhqe6femt9m.dlg@40tude.net... > ... >> I don't think we should much care about backward compatibility with regard >> to generics.
> Well, I doubt that would be very popular with anyone that has existing Ada > code that they want to use with the latest version of the language.
> As Robert Dewar says, incompatibilities have a very high bar. There has to > be real and compelling value for an incompatibility. I don't see that in > this case that that it not clear that the revised situation is really better > than the current one -- it's mostly a sideways move.
True, but there are two very different cases, depending on whether the change is in the semantics or else detected by the compiler. The latter is not a big issue. If we one day decided to use the word "kill" instead of "abort", that would be rather minor nuisance. But if we decided that "abort" would spawn a copy of the task, that would be a catastrophe.
>> My take is that any generic code is potentially broken. Anyone who uses >> generics beyond very trivial cases should know that, and mentally prepare >> himself to fix his code over and over again.
> That's pretty cynical.
Yes. After years of using generics you have to become cynical. (:-))
> Most of time, once you get your generic working, you > hardly every touch it again.
Huh, I have lost my illusions long ago. It stays fixed right until a next compiler bug or a next fix of a compiler bug. Most of the generics are in half workarounds for programmer's misunderstanding of how generics actually work, for some compiler bugs, for some silly language limitations.
> Besides, you could make the above statement for > almost any Ada (or other programming language) code when it is reused.
To some extent, but the difference is qualitative. The only other Ada issue of comparable damaging potential is the lack of exception contracts. My personal estimation is that about 20% of time is spent on fixing generics and 20-30% on catching unexpected exceptions.
"Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
> My take is that any generic code is potentially broken. Anyone who uses > generics beyond very trivial cases should know that, and mentally prepare > himself to fix his code over and over again.
That is certainly not my experience. I use generics extensively; it's one of the best features of the language.
>> > "Hibou57 (Yannick Duchêne)" <yannick_duch...@yahoo.fr> wrote in messagenews:b6d32b60-333f-495d-> By jove, I think he's got it! :-)
>> What does mean “ By Jove ” ? (I'm not native English, sorry).
> By Jupiter
> Latin Jupiter Nom., Jovis Gen., Jovi Dat. ...
It's just an exclamation, like "wow" or "by God". Some people find "by God" offensive because their religion says it is a form of swearing, so they use "Jove" instead; Jove is a Roman god, so for modern Christians, "By Jove" is a less severe form of swearing than "by God".
Always interesting, the places comp.lang.ada gets to :).
On Fri, 30 Oct 2009 06:25:21 -0400, Stephen Leake wrote: > "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
>> My take is that any generic code is potentially broken. Anyone who uses >> generics beyond very trivial cases should know that, and mentally prepare >> himself to fix his code over and over again.
> That is certainly not my experience. I use generics extensively; it's > one of the best features of the language.
Do you use generic in other generics?
How does look the hierarchy matrix of?
This requires a bit explanation. A set of generics sharing some common parameter (like the number type in a generic matrix package) are kind of class, i.e. they declare sets of types dependant on the parameter (like vector, matrix etc). I call this almost "trivial".
Non-trivial it becomes when you have several such axes.
Here is an example of a mesh of generic packages with 4 axes:
Note that semantically the example is quite simple, almost evident. Its implementation and use is horrific. I would never consider it "fixed".
As for being the "best language feature", I hope that you would easily find lots of more useful and advanced Ada features. What about unconstrained types? User-defined numeric types? Packages (vs. types) as encapsulation modules? If any of these were removed it would not be Ada. On the contrary, Ada without generics sounds quite plausible to me.
On 30 oct, 20:32, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
> Do you use generic in other generics?
While I do not know if it is the kind of reply you were expected, here is mine : I use generics in other generics, when a generic has a formal type parameter which come from another generic package. If want want to assert the type T is provided (or derived from the one provided) by a package P, then both P and T must appear in the parameters. If P is generic (this can be legitimate), then you end up with a generic using another generic.
Note : and in that case, this may be useful to make this package visible from the outside (exporting the content via renames and subtype, is not always done exhaustively)
You may also understand you can have generics dealing with generics, when you use the Mixin pattern to add features in a well designed way, to that if you ever modify the Mixin package, then modifications applies to all the package created with this Minxin. The Mixin may be generic, and the package it receives as a parameter as well.
Apologizes if this was not the kind of question you were requesting about.
On Fri, 30 Oct 2009 19:06:56 -0700 (PDT), Hibou57 (Yannick Duchêne) wrote: > On 30 oct, 20:32, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > wrote: >> Do you use generic in other generics?
> While I do not know if it is the kind of reply you were expected, here > is mine : I use generics in other generics, when a generic has a > formal type parameter which come from another generic package. If want > want to assert the type T is provided (or derived from the one > provided) by a package P, then both P and T must appear in the > parameters. If P is generic (this can be legitimate), then you end up > with a generic using another generic.
> Note : and in that case, this may be useful to make this package > visible from the outside (exporting the content via renames and > subtype, is not always done exhaustively)
Yes, I do it as well. This is the case when a formal parameter of a generic is used in another generic.
Note that a generic child package can use formals of its parent. That is the case why your proposal about visibility is so important in my eyes. It is an *obvious* language bug.
The case is represented here:
generic type T is private; package P is end P;
generic package P.Q is Y : T; end P.Q;
with P.Q; generic with package PQ is new P.Q (<>); package R is X : PQ.T; -- Wring! You cannot see T, and there is no way to name it end R;
In R you see Y of a "non-existent type". This is obviously broken to me.
(Yes, I am extensively using the trick of subtype and renaming formal parameters you wrote about earlier)
But as I said, generics are broken per their nature. With the time it gets only worse. (:-()
> You may also understand you can have generics dealing with generics, > when you use the Mixin pattern to add features in a well designed way, > to that if you ever modify the Mixin package, then modifications > applies to all the package created with this Minxin. The Mixin may be > generic, and the package it receives as a parameter as well.
Yes I do it very often. But to give a word of warning, it is a road to hell. In our current project the diagram of generic units is several pages long, because of mixins. There is no other way because "high language priests" have decided that multiple inheritance were bad for us, so the language has crippled interface types instead of normal MI. The result is just horrific. Mixin is a bad design pattern, but I wrote about it and generics many times before.
"Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
> On Fri, 30 Oct 2009 06:25:21 -0400, Stephen Leake wrote:
>> "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
>>> My take is that any generic code is potentially broken. Anyone who uses >>> generics beyond very trivial cases should know that, and mentally prepare >>> himself to fix his code over and over again.
>> That is certainly not my experience. I use generics extensively; it's >> one of the best features of the language.
You'll have to download and unpack the code; my webserver doesn't have enough space for the unpacked HTML version (guess it's time to spend more money on the web server).
> This requires a bit explanation. A set of generics sharing some common > parameter (like the number type in a generic matrix package) are kind of > class, i.e. they declare sets of types dependant on the parameter (like > vector, matrix etc). I call this almost "trivial".
Right; SAL has that in sal-gen_math.
> Non-trivial it becomes when you have several such axes.
Yes. For example, Unbounded_Arrays have Index_Type and Item_Type.
> Here is an example of a mesh of generic packages with 4 axes:
> Note that semantically the example is quite simple, almost evident. Its > implementation and use is horrific. I would never consider it "fixed".
Sorry, I don't see the complexity; what are the four axes?
There are problems that can't be solved in Ada; that doesn't make Ada useless!
Problems that can be almost solved, and push the boundaries of the language, and be very frustrating.
> As for being the "best language feature", I hope that you would easily find > lots of more useful and advanced Ada features.
Defining a metric on Ada features is not easy. My vote for best feature changes month to month; the best one is the one I most recently used to solve a hard problem. This month, that's generics.
In previous months, it's been tasking, dispatching, interfaces, and rep clauses on packed record types.
> What about unconstrained types?
Yes, if the metric is "things that other languages don't have", that's high on the list.
> User-defined numeric types?
Not so important; I end up using the compiler types anyway, except for Unsigned_n in packed records. Ada should have defined _all_ of Unsigned_n, for n = 1 .. 64, in the first place.
Distinct numeric types (derived from compiler defined types) is important.
> Packages (vs. types) as encapsulation modules?
That's just obvious; I wouldn't use a language that doesn't have that :).
Even C++ has that now. Not called packages, but close enough.
> If any of these were removed it would not be Ada. On the contrary, > Ada without generics sounds quite plausible to me.
True. Ada without overloading is "plausible" as well. But that's just another metric.
On Sat, 31 Oct 2009 08:44:18 -0400, Stephen Leake wrote: > "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
>> Non-trivial it becomes when you have several such axes.
> Yes. For example, Unbounded_Arrays have Index_Type and Item_Type.
Now consider I/O packages for Item_Type and Index_Type, and a package for Unbounded_Array I/O that uses all these three. At some point the structure of dependencies becomes a DAG.
>> Here is an example of a mesh of generic packages with 4 axes:
>> Note that semantically the example is quite simple, almost evident. Its >> implementation and use is horrific. I would never consider it "fixed".
> Sorry, I don't see the complexity; what are the four axes?
Base number, enumeration of truth values, arrays of, map to the truth value. These are initial parameters which group themselves in different combinations to produce new types in generic instances of the second generation of packages. These are selected in new combinations in the third generation and so on.
On 31 oct, 10:14, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
> Note that a generic child package can use formals of its parent. That is > the case why your proposal about visibility is so important in my eyes. It > is an *obvious* language bug.
A step to the side, still related to your comment ...
Although related by derivation, my packages were all along each others (I'm experimenting, so I try many things before I choose and know why). I've started to rework all package, to use child package when possible.
It seems it saves a lot to do so : shared generic parameters, so less generic parameters needed for instantiation.
I would like to say I feel (from higher to lower importance) child are nice for : 1) Shared privates subset (formally required) 2) Generics (not formally required, but may save a lot of stuff) 3) Mapping domain organization (nice, but not really required, although useful) ?) I'm still wondering about child packages and derivations (another subject opened about it).
Generic package hierarchy is nicer than I previously supposed
On Tue, 3 Nov 2009 00:25:24 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: > On 31 oct, 10:14, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > wrote: >> Note that a generic child package can use formals of its parent. That is >> the case why your proposal about visibility is so important in my eyes. It >> is an *obvious* language bug.
> A step to the side, still related to your comment ...
> Although related by derivation, my packages were all along each others > (I'm experimenting, so I try many things before I choose and know > why). I've started to rework all package, to use child package when > possible.
> It seems it saves a lot to do so : shared generic parameters, so less > generic parameters needed for instantiation.
There is also a competitive way of "generic interface package", so to say. That is when generic parameters are passed with another generic package rather than directly. E.g.:
generic type T is private; with function "+" (Left, Right : T) return T; package Generic_Interface is -- No own declarations, the package promotes its formal parameters -- to other packages end Generic_Interface;
with Generic_Interface; generic with package Parameters is new Generic_Interface (<>); package P is -- Here we can define some further operations on Parameters.T and -- other types based on Parameters.T end P;
> Generic package hierarchy is nicer than I previously supposed
Yes, but beware that there are *three* hierarchies:
1. one of the generic packages 2. of the instances of generic packages (you can instantiate a generic child of generic A as a non-generic child of non-generic B) 3. of nested packages (you can instantiate within a package)
A creative use of 1-3 may create a perfect mess out of your program...
On 3 nov, 10:59, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
> > Generic package hierarchy is nicer than I previously supposed
> Yes, but beware that there are *three* hierarchies:
> 1. one of the generic packages > 2. of the instances of generic packages (you can instantiate a generic > child of generic A as a non-generic child of non-generic B) > 3. of nested packages (you can instantiate within a package)
> A creative use of 1-3 may create a perfect mess out of your program...
I was not really sure about the meaning of “ mess out ” (the term you used), now I suppose this may mean “ real mess ”, and here is why.
I see at least three productive enough mess seeds with generic child hierarchy (from the less to the most nasty) 1) The implicit with which comes with all child packages, generic or not (I had never really enjoyed this implicit With). 2) The miss-match between the generic Withed path and the actual instance matching path 3) The naming nightmare which comes while creating the instance hierarchy
With more details : 1) Dependencies are clearly explicit with classic packages, this is no more the case with child packages. I know this is the same with non- generic, but this is not really welcome to me (I sometime dream about child packages hierarchy which would require explicit With). 2) Let A, a generic package, B, a generic child of A, C, an instance of A, then instantiating C.B requires to With A.B. I understand why it is this way (although this could have been another way too), but an A.B whose A actually and implicitly match C, does not help to be clear. 3) The one I really do not like : with same packages as in #2, instantiating A.B as a child of C, requires to use a new name which cannot be B, and if the name B is the most natural one in the context of A, this mostly mean this would be the same in the context of C, thus the naming nightmare. For the purpose of the comment which will follows right after, let call it D.
To reword what you were saying, there is indeed three hierarchies and not two : the source generic hierarchy (like A.B), the instance hierarchy (like C.D) and beside this instance hierarchy, another implicit generic hierarchy (like C.B), and this is hard to deal with.
Yes, now I'm sure you were really talking about mess.
#3 may be solved using a standard prefix for all generics, like Generic_, but I do not like it, because this easily ends in too much long paths. Now I'm seeking for a more clever way to easily handle this three-hierarchies structure. This would not Solve #2 any way.
On Thu, 5 Nov 2009 02:38:46 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: > #3 may be solved using a standard prefix for all generics, like > Generic_, but I do not like it, because this easily ends in too much > long paths. Now I'm seeking for a more clever way to easily handle > this three-hierarchies structure. This would not Solve #2 any way.
I am using "Generic_" because it is almost impossible to do anything otherwise if you have really many generics. And I do, because I have to.
If anything has to have a separate name space then generics is the first candidate. Generic unit is not a unit, it is a macro, a term of the meta language. There is no reason to have it also a proper name in the object language. The object language does not operate it. This is comparable to the names of the "cut" and "paste" buttons in the IDE. Why an integer variable may not have the same name as the "paste" button? (:-))
On 5 nov, 12:00, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
> I am using "Generic_" because it is almost impossible to do anything > otherwise if you have really many generics. And I do, because I have to.
Then, may be a point to discuss about : when using a "_Mixin" packages (or "_Facet", after Rosen, this is the same), as a "_Mixin" package is generic (this would not make sense otherwise), the "Generic_" prefix may not be needed when the package is "_Mixin". Or perhaps "_Mixin" (nor "_Facet") should not be used after-all, and only "Generic_" should be (showing no difference between "_Mixin" and others "Generic_").
On Thu, 5 Nov 2009 04:16:11 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: > On 5 nov, 12:00, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > wrote: >> I am using "Generic_" because it is almost impossible to do anything >> otherwise if you have really many generics. And I do, because I have to. > Then, may be a point to discuss about : when using a "_Mixin" packages > (or "_Facet", after Rosen, this is the same), as a "_Mixin" package is > generic (this would not make sense otherwise), the "Generic_" prefix > may not be needed when the package is "_Mixin". Or perhaps > "_Mixin" (nor "_Facet") should not be used after-all, and only > "Generic_" should be (showing no difference between "_Mixin" and > others "Generic_").
Sounds interesting. Can you give some examples?
BTW, Generic_ becomes quite obtrusive with children packages. When you have:
generic ... package Generic_Grandfather.Geneirc_Father.Generic_Son is
you start to think who is a generic_idiot here? (:-))
On 5 nov, 15:09, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
> On Thu, 5 Nov 2009 04:16:11 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: > > On 5 nov, 12:00, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > > wrote: > >> I am using "Generic_" because it is almost impossible to do anything > >> otherwise if you have really many generics. And I do, because I have to. > > Then, may be a point to discuss about : when using a "_Mixin" packages > > (or "_Facet", after Rosen, this is the same), as a "_Mixin" package is > > generic (this would not make sense otherwise), the "Generic_" prefix > > may not be needed when the package is "_Mixin". Or perhaps > > "_Mixin" (nor "_Facet") should not be used after-all, and only > > "Generic_" should be (showing no difference between "_Mixin" and > > others "Generic_").
> Sounds interesting. Can you give some examples?
You are more experienced than I am, so this may not sounds so much interesting after-all
I was talking about the "_Mixin" design pattern, which is a suggested way to do something like MI (Multiple Inheritance) with Ada. I think you do not use it, as your talked about some personal success stories you had with the Interface construct, and "_Mixin" is supposed to be the generic way to do most of what Interface can do. In the previous context, I was to say that as the "_Mixin" design pattern only makes sense with generics, if a package as the "_Mixin" suffix, there is no need to add the "Generic_" prefix, because "_Mixin" implies the package is generic. Then, as "_Mixin" and "Generic_" both means "generic", I was simply wondering if "_Mixin" was to be really used or not (finally, I think it is of real interest, so I did not drop "_Mixin" in favor or "Generic_").
Providing I've understood your question the proper way.
On Fri, 6 Nov 2009 04:19:10 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: > On 5 nov, 15:09, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> > wrote: >> On Thu, 5 Nov 2009 04:16:11 -0800 (PST), Hibou57 (Yannick Duchêne) wrote: >>> On 5 nov, 12:00, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> >>> wrote: >>>> I am using "Generic_" because it is almost impossible to do anything >>>> otherwise if you have really many generics. And I do, because I have to. >>> Then, may be a point to discuss about : when using a "_Mixin" packages >>> (or "_Facet", after Rosen, this is the same), as a "_Mixin" package is >>> generic (this would not make sense otherwise), the "Generic_" prefix >>> may not be needed when the package is "_Mixin". Or perhaps >>> "_Mixin" (nor "_Facet") should not be used after-all, and only >>> "Generic_" should be (showing no difference between "_Mixin" and >>> others "Generic_").
>> Sounds interesting. Can you give some examples? > You are more experienced than I am, so this may not sounds so much > interesting after-all
> I was talking about the "_Mixin" design pattern, which is a suggested > way to do something like MI (Multiple Inheritance) with Ada. I think > you do not use it, as your talked about some personal success stories > you had with the Interface construct, and "_Mixin" is supposed to be > the generic way to do most of what Interface can do.
In fact I am forced to use both because MI is not supported for concrete types. I have MI only in the interfaces. There are generics to provide implementations for the concrete types implementing those interfaces. It is awfully complex, I hate it, but I know no other way to do this.
The problem of naming is only of a facet of the bigger mess. It is a consequence of a bad pattern, but that pattern is imposed by the language.
> In the previous > context, I was to say that as the "_Mixin" design pattern only makes > sense with generics, if a package as the "_Mixin" suffix, there is no > need to add the "Generic_" prefix, because "_Mixin" implies the > package is generic. Then, as "_Mixin" and "Generic_" both means > "generic", I was simply wondering if "_Mixin" was to be really used or > not (finally, I think it is of real interest, so I did not drop > "_Mixin" in favor or "Generic_").
Yes, that was my question too. It looks to me an interesting idea to name generics after their roles. Mixin is probably too general, there are several scenarios where generics are used. MI emulation is one case. Another (also mixin) is that when you had layered protocols and did not want to specify the transport layer. You could make it a generic parameter, an abstract base type from which higher levels derive. Yet another is parallel hierarchies of types, like of objects and of handles to them etc.
Maybe such common patterns could be classified and given recognizable suffixes or prefixes instead of rather empty Generic_, which adds no value beyond merely separating the name space.