CVS difference for acs/ac-00078.txt

Differences between 1.1 and version 1.2
Log of other versions for file acs/ac-00078.txt

--- acs/ac-00078.txt	2003/09/19 01:42:26	1.1
+++ acs/ac-00078.txt	2004/02/04 00:51:12	1.2
@@ -482,3 +482,319 @@
 
 ****************************************************************
 
+From: David Wheeler
+Sent: Saturday, December 13, 2003  9:52 AM
+
+!subject Combine with and use clauses into "with use P"
+!reference RM95-10.1.2(4)
+!from David A. Wheeler 2003-12-13
+!keywords with, use, visibility
+!difficulty Easy
+!problem
+Programs using many use clauses can become lengthy and
+require significant visual checking between package names in
+the with and use clauses.  For example, if there are 10 with'ed packages,
+and 8 used packages, which packages were NOT used?
+And was that accidental or intentional?
+Most languages specify visibility with the importation statement
+to prevent this problem.
+
+!proposal
+Permit "with" clauses to be followed by an optional "use", in
+which case it has the effect of a with of the library unit names
+followed by a use of the same list (as defined in section 8.4).
+
+!wording
+Change with_clause to
+with_clause ::= with [use] library_unit_name {, library_unit_name};
+
+Then state "If a with_clause includes the "use" option, then the
+visibility of the listed units is the same as if a use_package_clause
+had been used (as defined in 8.4)."
+
+!discussion
+This should be a trivial change to compilers, so the cost should be low.
+There are no backward-compatibility issues.
+
+****************************************************************
+
+From: Nick Roberts
+Sent: Saturday, December 13, 2003  11:26 AM
+
+>!wording
+>Change with_clause to
+>with_clause ::= with [use] library_unit_name {, library_unit_name};
+
+I completely endorse this amendment except for my (trivial) preference
+for "and use" rather than just "use". Even then, this is only a mild
+preference.
+
+!wording
+Change with_clause to
+with_clause ::= with [and use] library_unit_name {, library_unit_name};
+
+****************************************************************
+
+From: Martin Krischik
+Sent: Sunday, December 14, 2003  6:45 AM
+
+I speak against. To many "use" clauses make the code harder to
+understand therefore excessive use of "use"  should not be made easier.
+
+On a side note the OP: '"use" is not only allowed on libraty level. You
+can "use" in procedures, declare etc. pp:
+
+procedure Some_String_Opreations
+is
+    use Ada.Strings.Unbounded_Strings:
+begin
+    ....
+
+It is much better to make the packages only visible where you actualy
+need them.
+
+****************************************************************
+
+From: Robert A. Duff
+Sent: Saturday, January 17, 2004  2:26 PM
+
+Martin Krischik said:
+
+> I speak against. To many "use" clauses make the code harder to
+> understand therefore excessive use of "use"  should not be made easier.
+
+I do not support the "with and use" idea, because it's not important
+enough.  However, I disagree with the punitive school of language design
+expressed here.
+
+I agree with Martin that "use" should be used sparingly.  However, I'm
+going to use it exactly where I think it's appropriate, and no more, and
+I don't need rules and regulations inhibiting me from using it.  The
+language rules should be intended to prevent mistakes -- not to punish
+evil programmers with carpal tunnel syndrome.  Nobody is going to type
+"use Some_Package" by accident!
+
+Suppose "Unchecked_Conversion" were called, say, "Cast".  Would
+programmers then run around adding unchecked conversions all over the
+place, just because it's now easier to type?  Of course not.  Cast/U_C
+should be used sparingly, and isolated, and making me type a long name
+is not going to stop me from using it where I, the programmer, think
+it's a appropriate, and making the name short is not going to cause me
+to use it where (in my opinion) it's inappropriate.
+
+> On a side note the OP: '"use" is not only allowed on libraty level. You
+> can "use" in procedures, declare etc. pp:
+>
+> procedure Some_String_Opreations
+> is
+>     use Ada.Strings.Unbounded_Strings:
+> begin
+>     ....
+>
+> It is much better to make the packages only visible where you actualy
+> need them.
+
+Agreed, but I don't need no stinkin' language designer telling me that. ;-)
+I, the programmer, can make these decisions just fine thank you very
+much.
+
+By the way, I agree with Jeff Carter, who said (way back on 10 Sep 2003):
+
+> If we're going to do something like, and I'm not convinced it's needed
+> or even desireable, then why not simply say that, in a context clause
+> and ONLY in a context clause, one can write
+>
+> use X;
+>
+> where X has not been mentioned before, and have it equivalent to
+>
+> with X; use X;
+
+That would be the right approach.  But it's not *quite* that simple,
+because "use" is legal in some cases where "with" is not (namely, nested
+packages).  Jeff's rule would cause incompatibilities, because "use
+A.B.C;" is currently legal when C is nested in library package A.B, so
+the implied "with A.B.C;" would be illegal.  So the rule should be "use
+A.B.C;" implies "with A.B;" or whatever prefix of the name is a library
+unit.
+
+This rule would be an improvement, because it would make context clauses
+where someone wisely chose to use use more readable.  And when someone
+UNwisely chooses to use use -- well, I don't care; it's not our job as
+language designers to prevent that (it's hopeless anyway).
+
+****************************************************************
+
+From: Martin Dowie
+Sent: Saturday, January 17, 2004  5:59 PM
+
+> I do not support the "with and use" idea, because it's not important
+> enough.  However, I disagree with the punitive school of language design
+> expressed here.
+
+I don't support the idea (as a user of Ada) as AI-00252 has made it to
+"Amendment 200Y" status and this (I think) would cater for a large
+percentage of where people find "with and use" attractive...
+
+Vote "Yes" for AI-00252!! :-)
+
+****************************************************************
+
+From: Jeffery Carter
+Sent: Saturday, January 17, 2004  7:24 PM
+
+Robert A Duff wrote:
+
+> By the way, I agree with Jeff Carter, who said (way back on 10 Sep
+> 2003):
+>
+>> If we're going to do something like, and I'm not convinced it's
+>> needed or even desireable, then why not simply say that, in a
+>> context clause and ONLY in a context clause, one can write
+>>
+>> use X;
+>>
+>> where X has not been mentioned before, and have it equivalent to
+>>
+>> with X; use X;
+
+By now I thought nobody had paid any interest to that post.
+
+> That would be the right approach.  But it's not *quite* that simple,
+> because "use" is legal in some cases where "with" is not (namely,
+> nested packages).  Jeff's rule would cause incompatibilities, because
+> "use A.B.C;" is currently legal when C is nested in library package
+> A.B, so the implied "with A.B.C;" would be illegal.  So the rule
+> should be "use A.B.C;" implies "with A.B;" or whatever prefix of the
+> name is a library unit.
+
+I think I've never had a use clause in a context that didn't mention
+something that could also be in a with clause, so I didn't think of this
+problem. Perhaps the easiest solution would be to allow this notation
+only for library units, so the implied with would be legal. It the name
+is not a library unit, the use clause would be illegal.
+
+****************************************************************
+
+From: Robert A. Duff
+Sent: Sunday, January 18, 2004  11:22 AM
+
+I don't see how that can work.  The "notation" we're talking about is
+just the use_clause, and we can't make that notation illegal in cases
+where it is currently legal.  Example:  Suppose A.B is a library
+package, and C is a package nested in A.B.  It is currently legal
+to say:
+
+    with A.B; use A.B.C;
+
+Your rule above, if I understand it correctly, says "use A.B.C" is
+illegal, because A.B.C is not a library unit.
+
+****************************************************************
+
+From: Jeffery Carter
+Sent: Sunday, January 18, 2004 11:43 PM
+
+You're probably right. It doesn't really matter, since Ada doesn't need
+something like this.
+
+****************************************************************
+
+From: Martin Krischik
+Sent: Monday, January 19, 2004  10:51 AM
+
+> I agree with Martin that "use" should be used sparingly.  However, I'm
+> going to use it exactly where I think it's appropriate, and no more, and
+> I don't need rules and regulations inhibiting me from using it.  The
+> language rules should be intended to prevent mistakes -- not to punish
+> evil programmers with carpal tunnel syndrome.  Nobody is going to type
+> "use Some_Package" by accident!
+
+While I accept the rest of your post I disacree on this one. I think I would
+be a rich man if I had a euro for every time some programmer (or text editor
+macro) typed:
+
+with xxxx; use xxxx;
+
+without thinking about it - i.E. xxxx is only referenced once. In
+comp.lang.ada I have seen more then one beginner who saw the above in there
+tutorial copied it without thinking and run head on into name clashes.
+
+But prehaps the problem are the tutorial writers. I was 6 month into Ada
+before found out that "use" is not library level only.
+
+****************************************************************
+
+From: Alexandre E. Kopilovitch
+Sent: Monday, January 19, 2004  1:24 PM
+
+Perhaps the following form may provide a reasonable compromise:
+
+  WITH package-name AND USE THIS PACKAGE;
+
+- with this form the repetition of the package-name is avoided without
+introducing of an unwanted shorthand.
+
+****************************************************************
+
+From: Martin Dowie
+Sent: Tuesday, January 20, 2004  12:48 AM
+
+"THIS" isn't currently a reserved word and I know of at least one person :-)
+who uses it as an object name, particularly as a 'renames', in a lot of
+existing
+code...
+
+****************************************************************
+
+From: Alexandre E. Kopilovitch
+Sent: Tuesday, January 20, 2004  11:51 AM
+
+> "THIS" isn't currently a reserved word
+
+Yes, but I meant that THIS is non-reserved keyword here.
+
+> and I know of at least one person :-)
+> who uses it as an object name, particularly as a 'renames', in a lot of
+> existing code...
+
+I think that person probably will agree with this usage of THIS as non-reserved
+keyword, because it is used here in closely related sense.
+
+****************************************************************
+
+From: Gautier de Montmollin
+Sent: Wednesday, January 21, 2004  4:22 AM
+
+If I understand well, you want to introduce words that could be normal
+identifiers in some parts and keywords in others ? You have little chance
+with Ada... Should I remind that Borland led their dialect of Pascal to a
+total mess with that mistake ?
+
+****************************************************************
+
+From: Pascal Leroy
+Sent: Tuesday, January 20, 2004  4:20 AM
+
+To all those involved in the recent "with and use" discussion on c.l.a.
+and ada-comment:
+
+I think it's worth reminding everyone that a proposal for "with and use"
+has been received by the ARG on September 9, 2003.  In accordance with
+the ARG procedures, section 2 clause 4 (see
+http://www.ada-auth.org/ai-files/minutes/ARGprc20.PDF), it has been
+classified as "received no action" and Ada Commentary #78 has been
+created to record the proposal (see
+http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AC-00078.TXT?rev=1.1).
+
+What this means is that, no matter how much mail+news traffic is
+generated on this topic, it is not going to be part of the Ada 05
+Amendment, unless two ARG members ask for the proposal to be reexamined
+(see the same clause of the ARG procedures).
+
+If some people feel strongly about "with and use", they should try to
+convince two ARG members to champion it, rather than indulge in endless
+chit chat on ada-comment.
+
+****************************************************************
+

Questions? Ask the ACAA Technical Agent