Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!hplabs!tektronix!orca!tekecs!jans From: jans@tekecs.UUCP (Jan Steinman) Newsgroups: net.lang.st80 Subject: Re: The wonderfulness of block arguments Message-ID: <7593@tekecs.UUCP> Date: Tue, 2-Sep-86 14:43:54 EDT Article-I.D.: tekecs.7593 Posted: Tue Sep 2 14:43:54 1986 Date-Received: Wed, 3-Sep-86 04:18:36 EDT References: <492@randvax.UUCP> Reply-To: jans@tekecs.UUCP (Jan Steinman) Organization: Tektronix, Wilsonville OR Lines: 21 Keywords: arguments In article <492@randvax.UUCP> obrien@randvax.UUCP (Michael O'Brien) writes: >If a block argument has the same name as a temporary variable, they seem >to be the same thing... > >It is entirely possible that there is some punning going on, and that if the >block is not evaluated, the block argument will refer to some other variable >or to random storage. Block arguments ARE temporary variables, at least from the Virtual Machine's point of view. (The Blue Book has a good discussion of this on pages 559-560.) The behavior cited is due to the scoping rules of the Smalltalk compiler -- temporaries cannot be used before they are declared. If the "[:blockArgumentName|" construct is thought of as an out-of-place temporary declaration, the described behavior makes sense. Block arguments are initialized to "nil", as are all temporary variables. -- :::::: Artificial Intelligence Machines --- Smalltalk Project :::::: :::::: Jan Steinman Box 1000, MS 60-405 (w)503/685-2956 :::::: :::::: tektronix!tekecs!jans Wilsonville, OR 97070 (h)503/657-7703 ::::::