[Pharo-project] Halt
The halt code is a mess. There are several open issues and should be several more. Here's what I found today... 1. Object>>setHaltOnce and friends are misleading See http://code.google.com/p/pharo/issues/detail?id=2621 All the accessors for the global HaltOnce are on the instance side of Object, making it unclear whether haltOnce and especially haltOnCount: are per-object or global. I suggest they be moved to some object representing the system (like SmalltalkImage or a delegate - I know we're trying to clean SmalltalkImage). #haltOnce Smalltalk haltOnceEnabled "used to be self haltOnceEnabled" ifTrue: [Smalltalk clearHaltOnce. "used to be self clearHaltOnce" ^ self halt]. makes it obvious that this is a global property, not per-instance. The first requires a comment (as indicated by the pending issue), the second is documented by the code. 2. Using Object to halt causes bloat, and doesn't buy much (except that's how we've always done it). See http://code.google.com/p/pharo/issues/detail?id=2394 for a proposal to change from "self haltOnce" to Halt once. 3. Is anyone using the versions that take a string message (e.g. #haltOnce:). A halt brings you into a debugger, so is the extra info worth the added complexity? p.s. right now, the versions are cut-and-pastes of each other I've already started to clean all this up and write tests, but wanted to be clear what the right direction is. Cheers, Sean -- View this message in context: http://forum.world.st/Halt-tp3774723p3774723.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Sean P. DeNigris wrote:
3. Is anyone using the versions that take a string message (e.g. #haltOnce:). A halt brings you into a debugger, so is the extra info worth the added complexity? p.s. right now, the versions are cut-and-pastes of each other
What about the versions that take a string message? Can we remove them since we have the call stack open in a debugger anyway? Sean -- View this message in context: http://forum.world.st/Halt-tp3774723p3775828.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Okay, I'm mostly through the refactoring. It is sooo much cleaner out of object. Many deprecated methods!! Here are a few points and questions... * Under protest :) I'm keeping the Object API, which forwards to Halt. * I was slightly liberated to find that halt behavior is not part of the ANSI standard * Halt onCount: - this is a weird one - It's currently global. Should it be per call, possibly with a (resumable?) error if called elsewhere? In other words, if I put in a Halt countOn: 3, and there is another #countOn: in the image that gets called and decrements the global count, it seems that this will give me confusing and hard to track down results. I guess maybe we can't pinpoint it to the exact call, but at least to the calling context. - The name is misleading. I thought of a few (Halt onPassNumber: 3, Halt onIterationNumber: 3, Halt onCallNumber: 3). Any suggestions while we're breaking compatibility, lol? - is there a lint check that says haltOnCount: and maybe haltOnce? - per object/method/process/exact call? * Is anybody using Object>>toggleHaltOnce? I'm toying with removing it as there are no senders in the image, and there are accessors and a testing method Sean -- View this message in context: http://forum.world.st/Halt-tp3774723p3776539.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Sean P. DeNigris wrote:
Here are a few points and questions...
Forgot one thing. #haltOnCount: currently depends on whether haltOnce is enabled. In my world, the purpose of haltOnce is so that you can put a halt down deep in the system where otherwise it may fire over and over (e.g. in the World loop). Since haltOnCount: is called once by definition, I want to remove the haltOnce-enabled check. Does that make sense/sound right? S -- View this message in context: http://forum.world.st/Halt-tp3774723p3776556.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Mon, Aug 29, 2011 at 5:44 PM, Sean P. DeNigris <sean@clipperadams.com> wrote:
* Is anybody using Object>>toggleHaltOnce? I'm toying with removing it as there are no senders in the image, and there are accessors and a testing method
I guess there are no senders because a developer calls this method from a workspace. As I understand it, it works that way: 1- you find an erroneous behavior 2- you put a "self halt" here and you notice that you have to close a thousand debuggers as a result 3- you change your "self halt" to "self haltOnce" to be sure only one debugger is going to pop up 4- you #toggleHaltOnce manually from a workspace and run your application 5- one debugger pops up and it automatically #toggleHaltOnce so that no other debugger will appear -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
* Halt onCount: - this is a weird one
I would remove it. I have never seen anybody using it.
* Is anybody using Object>>toggleHaltOnce? I'm toying with removing it as there are no senders in the image, and there are accessors and a testing method
That was probably there to call it from a menu. Seems to be useless, IMHO. Also make sure to remove all the global state that is added to SystemDictionary, this can easily be put into a class variable of Halt. Lukas -- Lukas Renggli www.lukas-renggli.ch
Thanks to Stephan Eggermont who paired with me all morning on this. Here are the results of the first pass in inbox (SLICE-Issue-2394-Halt-SeanDeNigris.1): Object * 16 methods deprecated * 5 halt methods that now forward to Halt Globals - can remove #HaltOnce and #HaltCount (I don't know how) Halt class * methods (all heavily refactored from the original Object implementation) - 5 for halting API - 3 to enable/disable haltOnce - 6 private helpers * 2 class instance variables (for haltOnce/onCount) World menu - updated to use Halt API Tests * 6 new assertions in 2 test methods * 4 test helpers for halt behavior * changed other halt tests to use the helpers Questions remaining: * countOn: (which I left it in for the time being) - safety & scope (see earlier in thread) - method name -- View this message in context: http://forum.world.st/Halt-tp3774723p3776819.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
cool! Alexandre On 29 Aug 2011, at 14:30, Sean P. DeNigris wrote:
Thanks to Stephan Eggermont who paired with me all morning on this.
Here are the results of the first pass in inbox (SLICE-Issue-2394-Halt-SeanDeNigris.1):
Object * 16 methods deprecated * 5 halt methods that now forward to Halt
Globals - can remove #HaltOnce and #HaltCount (I don't know how)
Halt class * methods (all heavily refactored from the original Object implementation) - 5 for halting API - 3 to enable/disable haltOnce - 6 private helpers * 2 class instance variables (for haltOnce/onCount)
World menu - updated to use Halt API
Tests * 6 new assertions in 2 test methods * 4 test helpers for halt behavior * changed other halt tests to use the helpers
Questions remaining: * countOn: (which I left it in for the time being) - safety & scope (see earlier in thread) - method name
-- View this message in context: http://forum.world.st/Halt-tp3774723p3776819.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
sounds great. Stef On Aug 29, 2011, at 7:30 PM, Sean P. DeNigris wrote:
Thanks to Stephan Eggermont who paired with me all morning on this.
Here are the results of the first pass in inbox (SLICE-Issue-2394-Halt-SeanDeNigris.1):
Object * 16 methods deprecated * 5 halt methods that now forward to Halt
Globals - can remove #HaltOnce and #HaltCount (I don't know how)
Halt class * methods (all heavily refactored from the original Object implementation) - 5 for halting API - 3 to enable/disable haltOnce - 6 private helpers * 2 class instance variables (for haltOnce/onCount)
World menu - updated to use Halt API
Tests * 6 new assertions in 2 test methods * 4 test helpers for halt behavior * changed other halt tests to use the helpers
Questions remaining: * countOn: (which I left it in for the time being) - safety & scope (see earlier in thread) - method name
-- View this message in context: http://forum.world.st/Halt-tp3774723p3776819.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (5)
-
Alexandre Bergel -
Damien Cassou -
Lukas Renggli -
Sean P. DeNigris -
Stéphane Ducasse