[etoys-dev] Etoys: Etoys-Richo.100.mcz

karl ramberg karlramberg at gmail.com
Mon Feb 13 13:52:20 EST 2012


On Tue, Feb 7, 2012 at 1:21 AM, Scott Wallace
<scott.wallace at squeakland.org> wrote:
> Actually, I think that when single-line-stepping with Richo's new Scriptor debugger feature, if an object's pen is down and a line of script is executed that moves the object, a pen trail *should* be put down, even if "batchPenTrails" is in effect.  A semantic argument for this choice can be made, given the definition of "batchPenTrails", but my preference is based just on common sense and least surprise.

I'm not sure what is the least surprise: that the program behaves
differently when single stepping or if its batching over like when it
ticking.
I find both sides of the argument have it's points.

But maybe we should ask why do we have batchPenTrials visible in
etoyFriendly mode in the first place? Because it's a very frustrating
issue to encounter if its accidentally turned on.

>
> (And anyone with experience with debugging any live system knows that the when you single-step at leisure through something that normally is happening in a flash, you're running the code in a different context and you're going to encounter differences...).
>
> If doing turtle-graphics of the sort in Karl's example, one probably does not want "batchPenTrails" to be turned on in the first place.

True.
What is the use case for batching pen trials ?

Karl

>
>  -- Scott
>
> On Feb 3, 2012, at 11:31 PM, commits at source.squeak.org wrote:
>
>> Ricardo Moran uploaded a new version of Etoys to project Etoys:
>> http://source.squeak.org/etoys/Etoys-Richo.100.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Etoys-Richo.100
>> Author: Richo
>> Time: 3 February 2012, 8:30:10 pm
>> UUID: f95a393c-27a3-e541-a345-4fd66b47cd8f
>> Ancestors: Etoys-kfr.99
>>
>> * Fixed step button behavior when #batchPenTrails option is on.
>>
>> =============== Diff against Etoys-kfr.99 ===============
>>
>> Item was changed:
>>  Object subclass: #EtoysDebugger
>> +     instanceVariableNames: 'scriptEditor next timesToRepeat highlighter startingPosition'
>> -     instanceVariableNames: 'scriptEditor next timesToRepeat highlighter'
>>       classVariableNames: ''
>>       poolDictionaries: ''
>>       category: 'Etoys-Debugger'!
>>
>> Item was changed:
>> + ----- Method: EtoysDebugger>>delete (in category 'initialization') -----
>> - ----- Method: EtoysDebugger>>delete (in category 'as yet unclassified') -----
>>  delete
>>       highlighter ifNotNil: [:h | h delete]!
>>
>> Item was changed:
>>  ----- Method: EtoysDebugger>>evaluateNextTile (in category 'evaluating') -----
>>  evaluateNextTile
>> +     [next = (scriptEditor tiles at: 1 ifAbsent: [nil])
>> +             ifTrue: ["We are about to evaluate the first tile"
>> +                     self updateStartingPosition].
>> +     self trailMorph batchPenTrails
>> +             ifTrue: [self evaluateNextTileWithBatchPenTrails]
>> +             ifFalse: [next evaluateOn: self]]
>> -     [next evaluateOn: self]
>>               on: Error do: [:err || newNext |
>>                       newNext := scriptEditor tiles at: 1 ifAbsent: [^ self].
>>                       newNext = next
>>                               ifTrue: [err pass]
>>                               ifFalse: [next := newNext].
>> +                     self evaluateNextTile]
>> +
>> + !
>> -                     self evaluateNextTile]!
>>
>> Item was added:
>> + ----- Method: EtoysDebugger>>evaluateNextTileWithBatchPenTrails (in category 'evaluating') -----
>> + evaluateNextTileWithBatchPenTrails
>> +     | penDown |
>> +     penDown := self scriptedPlayer getPenDown.
>> +     self scriptedPlayer setPenDown: false.
>> +     [next evaluateOn: self]
>> +             ensure: [self scriptedPlayer setPenDown: penDown].
>> +     (penDown and: [next = (scriptEditor tiles at: 1 ifAbsent: [nil])])
>> +             ifTrue: [| trailMorph tfm |
>> +                     "We've just evaluated the last tile, we should draw pen trail"
>> +                     trailMorph := self trailMorph.
>> +                     tfm := self scriptedPlayer costume owner transformFrom: trailMorph.
>> +                     trailMorph
>> +                             drawPenTrailFor: self scriptedPlayer costume
>> +                             from: (tfm localPointToGlobal: startingPosition)
>> +                             to: (tfm localPointToGlobal: self scriptedPlayerPosition)]!
>>
>> Item was changed:
>>  ----- Method: EtoysDebugger>>initializeWith: (in category 'initialization') -----
>>  initializeWith: aScriptEditorMorph
>>       scriptEditor := aScriptEditorMorph.
>>       next := scriptEditor tiles at: 1 ifAbsent: nil.
>> +     self updateStartingPosition;
>> +             initialize!
>> -     self initialize!
>>
>> Item was added:
>> + ----- Method: EtoysDebugger>>scriptedPlayer (in category 'accessing') -----
>> + scriptedPlayer
>> +     ^ scriptEditor playerScripted!
>>
>> Item was added:
>> + ----- Method: EtoysDebugger>>scriptedPlayerPosition (in category 'accessing') -----
>> + scriptedPlayerPosition
>> +     ^ self scriptedPlayer costume
>> +             ifNil: [0 at 0]
>> +             ifNotNil: [:m | m referencePosition]!
>>
>> Item was added:
>> + ----- Method: EtoysDebugger>>trailMorph (in category 'accessing') -----
>> + trailMorph
>> +     ^ self scriptedPlayer costume ifNil: [World] ifNotNil: [:m | m trailMorph]!
>>
>> Item was added:
>> + ----- Method: EtoysDebugger>>updateStartingPosition (in category 'initialization') -----
>> + updateStartingPosition
>> +     startingPosition := self scriptedPlayerPosition!
>>
>> _______________________________________________
>> etoys-dev mailing list
>> etoys-dev at squeakland.org
>> http://lists.squeakland.org/mailman/listinfo/etoys-dev
>
> _______________________________________________
> etoys-dev mailing list
> etoys-dev at squeakland.org
> http://lists.squeakland.org/mailman/listinfo/etoys-dev


More information about the etoys-dev mailing list