Any reason for assigning block parameter in inject:into:

J J azreal1977 at hotmail.com
Mon Apr 30 05:30:01 UTC 2007


>From: <bryce at kampjes.demon.co.uk>
>Reply-To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>Subject: Re: Any reason for assigning block parameter in inject:into:
>Date: Sun, 29 Apr 2007 22:52:45 +0100
>
>C copies the arguments and allows you to change them. Just
>like Smalltalk would if we allowed arguments to be changed.
>I think Pascal didn't allow arguments to be changed. Personally
>I'm happy with the status quo, but could live with mutable
>arguments too.
>
>Bryce

That's true.  C has only call-by-value semantics.  Call-by-reference in C is 
purely by convention.

However, I think what he is saying is: smalltalk is using references (i.e. 
pointers to locations, but that I don't have to manage myself with 
ref/dereffing), so if I pass a reference that is automatically dereffed, and 
then change it, wont that change the original place?  Think C++: if you see 
a function take a &param and it isn't const then you know something funny is 
going on (or you're looking at a bug).

_________________________________________________________________
Download Messenger. Join the i’m Initiative. Help make a difference today. 
http://im.live.com/messenger/im/home/?source=TAGHM_APR07




More information about the Squeak-dev mailing list