Copied from another thread:

http://wiki.squeak.org/squeak/899
http://wiki.squeak.org/squeak/1542
 


2010/1/20 Viktor Kerkez <alefnula@gmail.com>
Hi,

Since this is my first post on the list, first I want to thank you all for the great job you're doing on Pharo :) It was a real revelation when I discovered it :)

Now to the question:

I'm reading the Pharo by Example, and came to this part:

The problem with deepCopy is that it will not terminate when applied to a mutually recursive structure:
a1 := { 'harry' }.
a2 := { a1 }.
a1 at: 1 put: a2.
a1 deepCopy −! ... does not terminate!

(Pharo actually get stuck at the step: a1 at: 1 put: a2. but that's not the question :) )

1. Isn't this behaviour (the complete environment get stuck and there is no way to unfreeze it) considered a bug? I mean the environment shouldn't let you shoot yourself in the foot (at least not so easily). Actually the same behaviour can be created just doing: [true] whileTrue: []...

2. Shouldn't Pharo recognize recursive structures in some way?


I'm asking because I'm coming from a Python world, which is very similar to smalltalk in some manners and I'm trying to make a big picture comparison in my head.

1. I know that this doesn't really compares to Pharo which is a graphical environment, but in python you can always hit Ctrl-C and break the statements that block...

>>> while True:
...     pass
...
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt
>>>

Shouldn't the UI thread always be responsive?

2. And Python recognizes recursive structures:

>>> a = []
>>> a
[]
>>> a.append(5
...
KeyboardInterrupt
>>> a = []
>>> a
[]
>>> a.append(5)
>>> a
[5]
>>> a.append(a)
>>> a
[5, [...]]
>>> a[0]
5
>>> a[1]
[5, [...]]
>>> a[1][1][1][1][0]
5
>>>


Don't get me wrong, I'm not trying to start a language war :) I wouldn't got to page 171 if I'm not really interested in Smalltalk :-D I'm just trying to get a clearer vision if these are some things that are there for some reason (design decision), or they are just not yet implemented, or they cannot be implemented for some other reasons?

Thank you in advance for your time :),
Viktor


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project