[Pharo-project] Question on recursive structures
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
Hi, You can force an interrupt by CMD+i or CTRL+i (depending on the platform). Cheers, Doru On 20 Jan 2010, at 01:44, Viktor Kerkez wrote:
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
-- www.tudorgirba.com "Every now and then stop and ask yourself if the war you're fighting is the right one."
I tried that first, but it doesn't work :( I'm using Pharo on Linux (Ubuntu). On Wed, Jan 20, 2010 at 1:47 AM, Tudor Girba <tudor.girba@gmail.com> wrote:
Hi,
You can force an interrupt by CMD+i or CTRL+i (depending on the platform).
Cheers, Doru
On 20 Jan 2010, at 01:44, Viktor Kerkez wrote:
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
-- www.tudorgirba.com
"Every now and then stop and ask yourself if the war you're fighting is the right one."
Try alt (or control)-period ________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Viktor Kerkez Sent: Tuesday, January 19, 2010 7:53 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Question on recursive structures I tried that first, but it doesn't work :( I'm using Pharo on Linux (Ubuntu). On Wed, Jan 20, 2010 at 1:47 AM, Tudor Girba <tudor.girba@gmail.com<mailto:tudor.girba@gmail.com>> wrote: Hi, You can force an interrupt by CMD+i or CTRL+i (depending on the platform). Cheers, Doru On 20 Jan 2010, at 01:44, Viktor Kerkez wrote: 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<mailto:Pharo-project@lists.gforge.inria.fr> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- www.tudorgirba.com<http://www.tudorgirba.com> "Every now and then stop and ask yourself if the war you're fighting is the right one."
On 20 Jan 2010, at 01:57, Schwab,Wilhelm K wrote:
Try alt (or control)-period Great :) CMD-. even works for the UI process when it waits for a signal which never will arrive. Very useful to unfreeze the test runner.
Thanks Stefan
From: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Viktor Kerkez Sent: Tuesday, January 19, 2010 7:53 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Question on recursive structures
I tried that first, but it doesn't work :( I'm using Pharo on Linux (Ubuntu).
On Wed, Jan 20, 2010 at 1:47 AM, Tudor Girba <tudor.girba@gmail.com> wrote: Hi,
You can force an interrupt by CMD+i or CTRL+i (depending on the platform).
Cheers, Doru
On 20 Jan 2010, at 01:44, Viktor Kerkez wrote:
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
-- www.tudorgirba.com
"Every now and then stop and ask yourself if the war you're fighting is the right one."
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525
2010/1/20 Tudor Girba <tudor.girba@gmail.com>:
Hi,
You can force an interrupt by CMD+i or CTRL+i (depending on the platform).
This is not 'i' but '.' (period). -- Serge Stinckwich UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam Smalltalkers do: [:it | All with: Class, (And love: it)] http://doesnotunderstand.org/
Ohh, I guess I should go to sleep :). Doru On 20 Jan 2010, at 03:18, Serge Stinckwich wrote:
2010/1/20 Tudor Girba <tudor.girba@gmail.com>:
Hi,
You can force an interrupt by CMD+i or CTRL+i (depending on the platform).
This is not 'i' but '.' (period).
-- Serge Stinckwich UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam Smalltalkers do: [:it | All with: Class, (And love: it)] http://doesnotunderstand.org/
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com "Presenting is storytelling."
Thanks viktor we will fix that. There was a dicussion on removing deepCopy and cleaning the copy mess :) Stef On Jan 20, 2010, at 1:44 AM, Viktor Kerkez wrote:
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
On Wed, 20 Jan 2010, Viktor Kerkez wrote:
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!
Use #veryDeepCopy. #deepCopy doesn't support object graphs with circles. Note that you can't use objects with recursive graphs in an environment which sends #hash to the objects (like sets, dictionaries, or a workspaces), because collections' hash calculation doesn't work if the object graph is recursive. Example: This works in a workspace: | a b c | a := { 1 }. b := { a }. a at: 1 put: b. c := a veryDeepCopy. But this doesn't: a := { 1 }. b := { a }. a at: 1 put: b. c := a veryDeepCopy. There are other things you can't do with such objects, like printing.
(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...
If Alt/Cmd + . doesn't work, then something went really wrong.
while True: ... pass ... ^CTraceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt
Shouldn't the UI thread always be responsive?
No.
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?
Since the current code doesn't handle recursive structures, there's probably none in the image, and it still works. This makes me think that recursive structures are not that important in smalltalk. Fixing all the issues properly and without performance penalty may take a lot of effort. Levente
Thank you in advance for your time :), Viktor
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
Thank you all for the answers! :)
If Alt/Cmd + . doesn't work, then something went really wrong.
It seems that this works sometimes, and sometimes not, on the same operation. Depending on how long I let the operation run before I hit Alt-. :)
This works in a workspace: | a b c | a := { 1 }. b := { a }. a at: 1 put: b. c := a veryDeepCopy.
But this doesn't: a := { 1 }. b := { a }. a at: 1 put: b. c := a veryDeepCopy.
Actually both of this works in Pharo I have installed... It was a little confusing to have 2 deep copy methods :) But thanks for clarification.
There are other things you can't do with such objects, like printing.
I can understand why this doesn't work... I played a little with this and managed to make this work, but then the array has to loose its self evaluating aspect... And it probably broke everything else :-D But it was useful exercise :)
Since the current code doesn't handle recursive structures, there's probably none in the image, and it still works. This makes me think that recursive structures are not that important in smalltalk. Fixing all the issues properly and without performance penalty may take a lot of effort.
It seems that they are supported after all, just the operation set on them is limited... :) Thank you again, Viktor
participants (8)
-
Levente Uzonyi -
Mariano Martinez Peck -
Schwab,Wilhelm K -
Serge Stinckwich -
Stefan Marr -
Stéphane Ducasse -
Tudor Girba -
Viktor Kerkez