"Pascal Obry" wrote in message news:4DEE60E9.2020408@obry.net... > Le 07/06/2011 17:32, milouz a �crit : ... > I don't like use so when *I* design a package I prefer to take a > convention where use is not necessary. But when you want to use an already > built API you must often use it the way it has been designed to be used. > Take for example Unbounded_String, nobody will avoid using use in this > case... Look at this code: > > with Ada.Strings.Unbounded; > procedure Whatever is > S : Ada.Strings.Unbounded.Unbounded_String; > begin > Ada.Strings.Unbounded.Append (S, "toto"); > end Whatever; Looks good to me, it's what I would write. > Far better with: > > with Ada.Strings.Unbounded; > procedure Whatever is > use Ada.Strings.Unbounded; > S : Unbounded_String; > begin > Append (S, "toto"); > end Whatever; Maybe, if that is the entire package. But that's not usually the case, and typically the use of Unbounded_Strings is a very small fraction of the code. Moreover, if you also have fixed strings floating around (which I usually do), and some uses of Ada.Strings.Fixed as well (which also are pretty likely), use clauses are simply not going to work. The typical expression cannot be understood by the compiler, and trying to figure out why will be impossible. I sometimes rename the horribly named "To_Unbounded_String" to "+" (this operation needs to be short), and occasionally will use a "use clause" in a subprogram scope. But that's about it. > Because Ada.Strings.Unbounded (and all Ada runtime packages) has been > designed to be used with a use clause. Right, and it is unfortunate. With Claw, we tried to split the difference; we used short subprogram names and longer type names. The "Object" trick was too weird for me at the time (and I still don't like it much). Randy.