About #() and {}

Alexandre Bergel bergel at iam.unibe.ch
Wed Feb 16 09:48:06 UTC 2005


#() can produce bugs difficult to find. For instance, 
A>>foo  
  ^ #(1)

Now, execute 'A new foo at: 1 put: 2'. After that, 'A new foo' yields #(2), however the source code says that it should return #(1).

Markus told me that once he ran into this problem.

As a conclusion, I am not sure that it is simply a matter of compilation to optimize {} into #(). 

Alexandre


On Tue, Feb 15, 2005 at 09:42:50PM +0100, stéphane ducasse wrote:
> Hi all
> 
> some of you may remember that we were against the introduction of {}.
> Now (with the selfEvaluating package that fixes some ugly problems) I 
> think that {}
> is much better than #(). {} is a superset of #(). So there are only 
> idiots that do not
> change their mind :).
> The difference is compile-time vs. run-time creation which may be 
> important for
> some cases.
> 
> Now I have been discussing with andrew and he made a nice remark that a 
> smart compiler
> would create internally #() instead of {} when needed. And I was 
> wondering which can of
> analysis is required to do that. Would it be only when {} only contains 
> literals? Because this
> would be quite simple. But I may miss some important aspects of the 
> question.
> 
> 
> Stef
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



More information about the Squeak-dev mailing list