Go easy on the newbies, ok? :)   We were all there once...  It's been YEARS, 
but I recall being completely lost with collections and "which ones to use and 
how."   You are indeed correct about non-newbs needing to make sure that any 
errors are gracefully presented vs. taking out the vm.

Bill




________________________________________
From: pharo-project-boun...@lists.gforge.inria.fr 
[pharo-project-boun...@lists.gforge.inria.fr] on behalf of Andrew P. Black 
[bl...@cs.pdx.edu]
Sent: Monday, January 30, 2012 1:31 PM
To: Pharo Project
Subject: [Pharo-project] Collection new

Teaching a class of novices, it's not surprising that someone tried "Collection 
new".  What was surprising is that this got the VM is a loop of some kind, with 
emergency stack dumps and so on.

Here is my reply:


> On 30 Jan 2012, at 01:18 , Xingzhi Harry Pan wrote:
>
>> ...it's pretty innocent:
>> Collection new
>
>
> OK. I looked at this.  The problem comes when trying to print the collection. 
>  Somehow the VM gets confused when trying to do do: ... I'm not quite clear 
> why.
>
> The quick fix is to change the Collection>>new method to
>
>       self error: 'Collection is an abstract class, and cannot be 
> instantiated'
>
> However this will break Heap>>new: , which sends super new.  It ought to send 
> self basicNew instead.
>
> These two changes seem to avoid the problem, but I'm waiting to see ...
>
>       Andrew

But I don't understand the root cause.  Printing eventually sends do:, which is 
self subclassResponsibility.  Why don't we get a clean failure?

        Andrew



Reply via email to