J3/06-142 Date: 2006/02/16 To: J3 From: Malcolm Cohen Subject: Edits for Intelligent Macros part 1 References: J3/06-123r1. 1. Introduction This paper provides partial edits for Intelligent Macros (item J3-014); this part is the BLOCK construct. The specifications and syntax were in paper 06-123r1. 2. Notes 3. Edits to 04-007 [xiii] Add new feature "The BLOCK construct (allows declarations within executable statements)." [10:53+] 2.1 High level syntax, R213 executable-construct, add new production in alphabetic order "<> " [17:6] 2.4.3.1.1 Variable, second paragraph, after "or host association." insert new sentence "A named local variable of a BLOCK construct is a named variable that is declared in that construct, is not in COMMON, does not have the BIND attribute, and is not accessed by use association." {Call construct entities that are variables, local variables of the construct. We don't have to consider host association, because a BLOCK construct is not a scoping unit and therefore doesn't use host association.} [28:4+something] 3.3.1 Free source form, "Adjacent keywords..." table, insert into table "END BLOCK". {Make blanks between these keywords optional in free form.} [59:24+] 4.5.5.2 When finalization occurs, after second paragraph, insert new paragraph "A nonpointer nonallocatable local variable of a BLOCK construct is finalized immediately before it would become undefined due to termination of the BLOCK construct (16.5.6, item (19))." {Block construct entities can be finalised.} [115:8+] 6.3.3.1 Deallocation of allocatable variables, after second paragraph, insert new paragraph "When a BLOCK construct terminates, an allocatable variable that is a named local variable of the construct retains its allocation and definition status if it has the SAVE attribute; otherwise it is deallocated." [155:6+] 8.1 Executable constructs containing blocks, first paragraph, numbered list, insert new list item in alphabetic order "(1a) BLOCK construct". [169:1-] Immediately before 8.2 Branching, insert new subclause "8.1.7 BLOCK construct The BLOCK construct is a block which may contain declarations. R8m1 <> R8m2 <> [ : ] BLOCK R8m3 <> END BLOCK [ ] C8m1 (R8m1) If the of a specifies a , the corresponding shall specify the same . If the does not specify a , the corresponding shall not specify a . Specifications in a BLOCK construct declare construct entities whose scope is that of the BLOCK construct. Specification expressions in the are evaluated when the BLOCK statement is executed. The BLOCK construct terminates when: (a) a RETURN statement within the block is executed, or (c) transfer of control to a statement outside the block occurs." [409:16+] 16.3 Statement and construct entities, first paragraph, append new sentence: "An entity that is declared in a BLOCK construct and is not accessed by use association is a construct entity." {BLOCK constructs contain construct entities.} [410:14+] 16.3, append paragraph to subclause "If a global or local identifier accessible in the scoping unit of a BLOCK construct is the same as a construct entity of that BLOCK construct, the name is interpreted within the BLOCK construct as that of the construct entity." {Usual rules for hiding outer entities when you have a construct entity. We could probably finesse these... they are stated once per type of construct, which seems overly redundant.} [420:2] 16.5.3 Variables that are initially defined, item (3), change "either saved or are declared in a main program, MODULE," to "saved, local variables of a main program, or declared in a MODULE". {BLOCK construct entities are declared "in" a main program, but that does not make them implicitly saved.} [421:43+] 16.5.5 Events that cause variables to become defined, append new item "(27) Execution of the BLOCK statement of a BLOCK construct that has an unsaved nonpointer nonallocatable local variable causes all nonpointer default-initialized subcomponents of the variable to become defined." {Default-initialize unsaved construct entities on entry to the construct.} [423:28+] 16.5.6 Events that cause variables to become undefined, append new item "(19) When a BLOCK construct terminates, its unsaved local variables become undefined." [427:24] Annex A, "construct" definition, before "DO" insert "BLOCK". {Add BLOCK constructs to the list of constructs.} ===END===