🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.st80
Article #332

Re: The wonderfulness of block arguments

#332
From: Jan Steinman
Date: Tue, 02 Sep 1986 18:43
21 lines
1674 bytes
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 ::::::
Technical Details
Message-ID: <7593@tekecs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!hplabs!tektronix!orca!tekecs!jans
References: <492@randvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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