07-204 To: J3 From: Malcolm Cohen Subject: USE in BLOCK considered useful Date: 2007 May 01 1. Introduction At meeting 179, paper 07-169 claimed that allowing "USE" in "BLOCK" was "feature creep". This is historically inaccurate. None of the original specfications, syntax or edits for BLOCK contained a prohibition against USE. So it is the prohibition that is "feature creep" (in the reverse direction). We should revisit this issue and discuss it on the merits. 2. Discussion In fact UTI 084 had been originally added by paper 06-254r1 because at that meeting subgroup ran out of time to do the edits. At the time, the edits were slightly onerous because of the lack of the SAVE attribute on module variables. The edits are much simpler now, because modules do not "go out of scope" any more. There are several extra edits where the standard seems to be wrong anyway, irrespective of whether we allow USE in BLOCK. 3. Usefulness For "normal" programming, it is true that allowing USE in BLOCK is a mere convenience and not essential functionality. That said, it is most definitely convenient to be able to limit the scope of the USE to within a particular block, and not have to factor out all the uses of USE to the top of the program unit. However, for "macro" programming, it is much more important to be able to generate code with access to a module without the risk of name clashes. In fact it is almost essential, since a macro expansion in the middle of a program-unit has no way of going back to the top of the program unit and adding a USE statement! Without the ability to have USE in BLOCK, macros have much reduced access to modules in their generated code. 4. Edits to 07-007r1 [180:C805+1] "OPTIONAL, or USE" -> "or OPTIONAL". {Delete prohibition.} [289:11.2.2p2+0,2] After "scoping unit" insert "or BLOCK construct", twice. [289:11.2.2p2+5] "an entity" -> "a local entity". [289:11.2.2p2+6] Delete "in the local scoping unit". [289:11.2.2p2+7] "they" -> "the local entities". [289:11.2.2p2+8] Before "containing the USE statement" insert "or BLOCK construct". {Rewrite master USE statement paragraph to account for BLOCK. NOTE: This paragraph is too long and needs wordsmithing.} [290:11.2.2p6+0] "scoping unit" -> "specification part". {Paragraph begins "More than one ...". Obvious fix to allow BLOCK.} [290:11.2.2p8+1] This is after "may have the same" Before "identifier only if" insert "local". {Existing text is broken. It is only the local identifier that matters.} [290:11.2.2p8+1] Delete "to refer to an entity in the scoping unit". {Existing text probably broken and is unnecessary anyway.} [478:16.4p1+4-5 (last sentence)] Delete "An entity ... BLOCK ... entity." {Existing text is just wrong. There is and was nothing special about use associated entities whether there is a prohibition or not.} Then append new sentence "An entity that is declared in the specification part of a BLOCK construct, other than only in ASYNCHRONOUS and VOLATILE statements, is a construct entity." {Otherwise we are contradicting [90:8.1.4p2].} ===END===