Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass
| assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
---------------------------------------------------- The use case in details ----------------------------------------------------
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9
TileMorph>>literal
is
TileMorph>>literal: anObject
literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date, install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral
self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
P.S. You can download an example home.pr project from the links given in
http://wiki.squeak.org/squeak/6531
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent:
[nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent:
[nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent:
[nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
The project just needs to be dropped onto the desktop. Ignore the additional error message and try incrementing the 'forward' value of the car.
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
P.S. You can download an example home.pr project from the links given in
http://wiki.squeak.org/squeak/6531
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent:
[nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent:
[nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent:
[nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
Another necessary fix is to add
Preferences class
implicitSelfInTiles ^ self valueOfFlag: #implicitSelfInTiles ifAbsent: [false]
message protocol: 'standard queries'
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
The project just needs to be dropped onto the desktop. Ignore the additional error message and try incrementing the 'forward' value of the car.
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
P.S. You can download an example home.pr project from the links given in
http://wiki.squeak.org/squeak/6531
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name
ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name
ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
Where could I find these scripts? I have an idea to build financial contracts that could be scripted securely, but I need a cross=platform language. Would these Scripts provide a potential language for this use?
On 10/14/2017 01:44 PM, H. Hirzel wrote:
Another necessary fix is to add
Preferences class
implicitSelfInTiles ^ self valueOfFlag: #implicitSelfInTiles ifAbsent: [false]
message protocol: 'standard queries'
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
The project just needs to be dropped onto the desktop. Ignore the additional error message and try incrementing the 'forward' value of the car.
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
P.S. You can download an example home.pr project from the links given in
http://wiki.squeak.org/squeak/6531
On 10/14/17, H. Hirzel hannes.hirzel@gmail.com wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name
ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name
ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
The cause of the issue is ScriptEncoder >> #init:context:notifying: explicitly setting Smalltalk to be the environment instead of Smalltalk environment.
Levente
On Sat, 14 Oct 2017, H. Hirzel wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
The current version of ScriptEncoder>>init:context:notifying: (tfel 8/2/2016) sets the environment to "class environment" but the current version in trunk (tfel 9/30/2016) sets it to "Smalltalk".
The change was introduced here:
Name: EToys-tfel.266 Author: tfel Time: 30 September 2016, 11:38:29.998245 am UUID: 984ecc63-aae1-7445-b5ae-8b0f1a83be61 Ancestors: EToys-tfel.265
for now, always compile scripts in the global environment.
Maybe the prior version was better? Or should it have been changed from "class environment" to "Smalltalk environment" in order to do what was originally intended in EToys-tfel.266?
Dave
On Sat, Oct 14, 2017 at 11:22:44PM +0200, Levente Uzonyi wrote:
The cause of the issue is ScriptEncoder >> #init:context:notifying: explicitly setting Smalltalk to be the environment instead of Smalltalk environment.
Levente
On Sat, 14 Oct 2017, H. Hirzel wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
If the intention was to compile it in the global environment, as the commit message says, then "Smalltalk environment" is the right environment to use.
Levente
On Sat, 14 Oct 2017, David T. Lewis wrote:
The current version of ScriptEncoder>>init:context:notifying: (tfel 8/2/2016) sets the environment to "class environment" but the current version in trunk (tfel 9/30/2016) sets it to "Smalltalk".
The change was introduced here:
Name: EToys-tfel.266 Author: tfel Time: 30 September 2016, 11:38:29.998245 am UUID: 984ecc63-aae1-7445-b5ae-8b0f1a83be61 Ancestors: EToys-tfel.265
for now, always compile scripts in the global environment.
Maybe the prior version was better? Or should it have been changed from "class environment" to "Smalltalk environment" in order to do what was originally intended in EToys-tfel.266?
Dave
On Sat, Oct 14, 2017 at 11:22:44PM +0200, Levente Uzonyi wrote:
The cause of the issue is ScriptEncoder >> #init:context:notifying: explicitly setting Smalltalk to be the environment instead of Smalltalk environment.
Levente
On Sat, 14 Oct 2017, H. Hirzel wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
Thanks Levente, hopefully fixed in EToys-dtl.310
Dave
On Sat, Oct 14, 2017 at 06:34:23PM -0400, David T. Lewis wrote:
The current version of ScriptEncoder>>init:context:notifying: (tfel 8/2/2016) sets the environment to "class environment" but the current version in trunk (tfel 9/30/2016) sets it to "Smalltalk".
The change was introduced here:
Name: EToys-tfel.266 Author: tfel Time: 30 September 2016, 11:38:29.998245 am UUID: 984ecc63-aae1-7445-b5ae-8b0f1a83be61 Ancestors: EToys-tfel.265
for now, always compile scripts in the global environment.
Maybe the prior version was better? Or should it have been changed from "class environment" to "Smalltalk environment" in order to do what was originally intended in EToys-tfel.266?
Dave
On Sat, Oct 14, 2017 at 11:22:44PM +0200, Levente Uzonyi wrote:
The cause of the issue is ScriptEncoder >> #init:context:notifying: explicitly setting Smalltalk to be the environment instead of Smalltalk environment.
Levente
On Sat, 14 Oct 2017, H. Hirzel wrote:
Hello
after loading a Etoys project into a most recent trunk image incrementing a tile value actually generates an updated script which is to be compiled.
Recompiling the script causes an error in
ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
Replacing
assoc := self environment associationAt: cue getClass name ifAbsent: [nil].
with
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
Made the script to work but errors later on came up at the same place for other reasons. In particular it was not possible to commit the changed 'Compiler' package to the inbox.
Do you have any suggestions how to deal with this problem?
Kind regards Hannes
The use case in details
I drop an Etoys project into a fully updated trunk image.
If I click an arrow the following message is sent to aTileMorph
TileMorph>>arrowAction:
If it is a number a new value is set, for example
aTileMorph literal: 9 TileMorph>>literal
is
TileMorph>>literal: anObject literal := anObject. self updateLiteralLabel. self acceptNewLiteral. "Show that we are out of date,
install is needed"
#acceptNewLiteral looks for the topScript, i.e. the top morph containing the tiles
then it calls
topScript installWithNewLiteral
The topScript is a "ScriptEditor for #script1 player: Car"
ScriptEditorMorph>>installWithNewLiteral self removeSpaces. scriptName ifNotNil: [playerScripted ifNotNil: [playerScripted acceptScript: self topEditor
for: scriptName]]
playerScripted is aPlayer (Model subclass: #Player)
In playerScripted acceptScript: self topEditor for: scriptName
the playerScripted gets a node (class MethodNode) from aScriptEditorMorph
The node is told to #generate: the method for aCompiledMethodTrailer which has the data
'script1 (self color: (Color r: 0.419 g: 0.581 b: 1) sees: (Color r: 0.936 g: 0.936 b: 0.936)) ifFalse: [self turn: 160 + 40 random]. self forward: 9. self turn: 1. self bounce: ''silence'''
The node in turn asks aScriptEncoder
generateMethodOfClass: aCompiledMethodClass trailer: trailer
from: methodNode
aScriptEncoder asks
self allLiterals
and within that
self associationForClass ScriptEncoder>>associationForClass | assoc | assoc := self environment associationAt: cue getClass name ifAbsent: [nil]. ^assoc value == cue getClass ifTrue: [assoc] ifFalse: [Association new value: cue getClass]
This is the place where the code breaks
cue getClass
is Player140132117123
self environment
is SmalltalkImage
First a change from
assoc := self environment associationAt: cue getClass name
ifAbsent: [nil].
to
assoc := self environment globals associationAt: cue getClass
name ifAbsent: [nil].
worked after adding in addition
I could increment and decrement values in a tile.
However it was not possible to commit the changes to the inbox. An error message appeared at the same place.
squeak-dev@lists.squeakfoundation.org