Nicolas Cellier uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-nice.64.mcz
==================== Summary ====================
Name: Environments-nice.64
Author: nice
Time: 29 September 2016, 10:41:52.190388 am
UUID: 607ee3c4-cc23-ff46-9f28-edddf2118760
Ancestors: Environments-nice.63
Fix the postscript: it's Smalltalk globals that should be exported...
Note: Environment stack policies without testing if they already exist, so there's a big danger to exportmore than once! There might be undesired side effects (notifying more than once?)
=============== Diff against Environments-nice.63 ===============
Item was changed:
(PackageInfo named: 'Environments') postscript: '"It''s impossible to import a binding if not exported.
There''s nothing secret in Smalltalk (nor private)."
+ Smalltalk globals exportSelf.
- Smalltalk exportSelf.
'!
Nicolas Cellier uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-nice.63.mcz
==================== Summary ====================
Name: Environments-nice.63
Author: nice
Time: 29 September 2016, 10:29:59.273388 am
UUID: 1c6b29fd-c218-034b-8059-2a4e231109d4
Ancestors: Environments-mt.62
Update the class comment of Environment to match current instance variable list.
Update the postscript to export Smalltalk bindings.
=============== Diff against Environments-mt.62 ===============
Item was changed:
Object subclass: #Environment
instanceVariableNames: 'info declarations bindings undeclared policies observers'
classVariableNames: 'Default Instances'
poolDictionaries: ''
category: 'Environments-Core'!
+ !Environment commentStamp: 'nice 9/29/2016 10:27' prior: 0!
- !Environment commentStamp: 'cmm 12/20/2013 14:10' prior: 0!
I am a context for compiling methods. I maintain the namespace of classes and global variables that are visible to the methods compiled within me.
I have the following instance variables:
info <EnvironmentInfo>
Metadata about me and the code I contain.
- imports <Import>
- Rules for importing globals from other environments.
-
- exports <Export>
- Rules for exposing globals to other environments.
-
declarations <IdentityDictionary>
+ Bindings for class and other globals that have been declared inside me.
- Bindings for globals that have been declared inside me.
+ bindings <IdentityDictionary>
+ Bindings for all the class and global variables visible from the compiler.
+ It generally includes the declarations (see importSelf), plus other imports from other environments, including aliases.
- references <IdentityDictionary>
- Bindings for globals that are used by methods compiled inside me.
+ policies <Collection of: NamePolicy>
+ The list of rules for importing and exporting bindings to other environments.
- public <IdentityDictionary>
- Bindings for classes that have been declared inside me, and which satisfy the export rules contain in 'exports'.
+ observers <Collection of: Environment>
+ These are the environments importing some bindings from self, and which should be notified whenever we add/remove/change some binding.
+ !
- undeclared <Dictionary>
- Bindings for globals that are used by methods compiled inside me, but which aren't present in 'references' and couldn't be found via the rules in 'imports'.!
Item was changed:
+ (PackageInfo named: 'Environments') postscript: '"It''s impossible to import a binding if not exported.
+ There''s nothing secret in Smalltalk (nor private)."
+ Smalltalk exportSelf.
- (PackageInfo named: 'Environments') postscript: '"Recompile all methods to fix errant bindings"
- Compiler recompileAll.
'!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.798.mcz
==================== Summary ====================
Name: Kernel-nice.798
Author: nice
Time: 30 July 2013, 10:34:15.34 pm
UUID: e02ae597-3f6d-40b9-9468-bf01416db6de
Ancestors: Kernel-nice.797
Better fix for http://bugs.squeak.org/view.php?id=1554
A class variable defined in a superclass should take precedence over a global variable.
First look in local class variables.
Then look in local sharedPools (a local sharedPool will shadow a super class variable, that sounds fair).
Then look in superclass pools.
When superclass chain is exhausted, look in the Environment that were provided as parameter.
Note that this is mostly squeak 1.x implementation of #scopeHas:ifTrue: (or st-80), except that anEvironment parameter replaces Smalltalk.
This way we avoid duplicate lookup of previous workaround.
And we never ever look in superclass environment, that's not necessarily ours.
This currently breaks some EnvironmentTest because inheriting superclass environment is a cheap and easy way to import all Smalltalk (unless you are not an Object or ProtoObject of course).
The longest and proper way would be to properly export some symbols from Smalltalk globals, and import them explicitely in the tested environment.
=============== Diff against Kernel-nice.797 ===============
Item was changed:
----- Method: Class>>bindingOf:environment: (in category 'compiling') -----
bindingOf: varName environment: anEnvironment
"Answer the binding of some variable resolved in the scope of the receiver"
| aSymbol binding |
aSymbol := varName asSymbol.
+ "First look in local classVar dictionary."
+ binding := self classPool bindingOf: aSymbol.
+ binding ifNotNil:[^binding].
- "First look in classVar dictionary."
- (self classThatDefinesClassVariable: aSymbol) ifNotNil:
- [:x | ^x classPool bindingOf: aSymbol].
+ "Next look in local shared pools."
- "Next look in shared pools."
self sharedPools do:[:pool |
binding := pool bindingOf: aSymbol.
binding ifNotNil:[^binding].
].
+ "Next look into superclass pools"
+ superclass ifNotNil: [^ superclass bindingOf: aSymbol environment: anEnvironment].
+
+ "No more superclass... Last look in declared environment."
+ ^anEnvironment bindingOf: aSymbol
- "Next look in declared environment."
- binding := anEnvironment bindingOf: aSymbol.
- binding ifNotNil:[^binding].
- "Finally look higher up the superclass chain and fail at the end."
- superclass == nil
- ifTrue: [^ nil]
- ifFalse: [^ superclass bindingOf: aSymbol].
-
!
Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.259.mcz
==================== Summary ====================
Name: EToys-tfel.259
Author: tfel
Time: 29 September 2016, 10:11:59.109594 am
UUID: 2f475582-bfa8-48fa-a9eb-362252d134ef
Ancestors: EToys-tfel.258
Another fix for copying Kedama, KedamaPatches need to reference the copy of their world, too, if that was copied.
=============== Diff against EToys-tfel.258 ===============
Item was added:
+ ----- Method: KedamaPatchMorph>>veryDeepFixupWith: (in category 'copying') -----
+ veryDeepFixupWith: deepCopier
+
+ super veryDeepFixupWith: deepCopier.
+ kedamaWorld := deepCopier references at: kedamaWorld ifAbsent: [kedamaWorld].!
Item was changed:
+ ----- Method: KedamaPatchMorph>>veryDeepInner: (in category 'copying') -----
- ----- Method: KedamaPatchMorph>>veryDeepInner: (in category 'as yet unclassified') -----
veryDeepInner: deepCopier
"the state of a Kedama patch is held in its forms, so we need to "
form := form deepCopy.
displayForm := displayForm deepCopy.
tmpForm := tmpForm deepCopy.
super veryDeepInner: deepCopier.!
Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.258.mcz
==================== Summary ====================
Name: EToys-tfel.258
Author: tfel
Time: 28 September 2016, 5:27:37.334594 pm
UUID: ef184947-0831-4b86-9f5f-5707547734bc
Ancestors: EToys-tfel.257
- Fix for duplicating KedamaMorphs with non-visible patches or turtles
- be careful not to loose top level projects when deleting projects through the etoys history morph
- setTurtleCount: on a vector player should go to the exampler player
=============== Diff against EToys-tfel.257 ===============
Item was changed:
----- Method: EToyProjectHistoryMorph>>confirmedDelete:evt:from: (in category 'as yet unclassified') -----
confirmedDelete: aProject evt: evt from: origin
self delete.
aProject = Project current ifTrue: [
^ self inform: 'Cannot delete current project' translated].
(self confirm: ('Do you really want to delete {1}
and all its content?' translated format: {aProject name}))
+ ifTrue: [
+ aProject isTopProject ifTrue: [Project current beTopProject].
+ aProject delete.
+ Project rebuildAllProjects].!
- ifTrue: [aProject delete].!
Item was changed:
----- Method: KedamaMorph>>duplicate (in category 'as yet unclassified') -----
duplicate
| allMorphBounds allMorphs allOwners copyW s w |
allMorphs := {self}, self player allPatchAndTurtleMorphs.
allOwners := allMorphs collect: #owner.
allMorphBounds := allMorphs allButFirst
inject: self bounds into: [:acc :next | next bounds merge: acc].
w := PasteUpMorph new.
w bounds: allMorphBounds.
w openInWorld.
w addAllMorphs: allMorphs.
copyW := w duplicate.
+ allMorphs withIndexDo: [:m :idx | (allOwners at: idx) ifNotNil: [:o | o addMorph: m]].
- allMorphs withIndexDo: [:m :idx | (allOwners at: idx) addMorph: m].
w delete.
s := SelectionMorph new.
s bounds: copyW bounds.
s selectSubmorphsOf: copyW.
^ s!
Item was added:
+ ----- Method: KedamaTurtleVectorPlayer2>>setTurtleCount: (in category 'slot-kedama') -----
+ setTurtleCount: aNumber
+
+ ^ exampler setTurtleCount: aNumber!
Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.257.mcz
==================== Summary ====================
Name: EToys-tfel.257
Author: tfel
Time: 28 September 2016, 2:02:17.012904 pm
UUID: a4bd9831-92ff-fb4f-9f7f-0681429e8add
Ancestors: EToys-tfel.256
make Kedama worlds copyable, by forcing it to always copy also its patches and turtles, and fixing up the deep copying so these players are copied correctly and their scripts are also recompiled correctly.
=============== Diff against EToys-tfel.256 ===============
Item was added:
+ ----- Method: KedamaExamplerPlayer>>veryDeepInner: (in category 'copying') -----
+ veryDeepInner: deepCopier
+ "Special code that handles user-added instance variables of a uniClass.
+ Copy all of my instance variables. Some need to be not copied at all, but shared. This is special code for the dictionary. See DeepCopier."
+
+ kedamaWorld := kedamaWorld veryDeepCopyWith: deepCopier.
+ turtles := turtles veryDeepCopyWith: deepCopier.
+ sequentialStub := sequentialStub veryDeepCopyWith: deepCopier.
+ super veryDeepInner: deepCopier.
+ !
Item was added:
+ ----- Method: KedamaMorph>>duplicate (in category 'as yet unclassified') -----
+ duplicate
+
+ | allMorphBounds allMorphs allOwners copyW s w |
+ allMorphs := {self}, self player allPatchAndTurtleMorphs.
+ allOwners := allMorphs collect: #owner.
+ allMorphBounds := allMorphs allButFirst
+ inject: self bounds into: [:acc :next | next bounds merge: acc].
+ w := PasteUpMorph new.
+ w bounds: allMorphBounds.
+ w openInWorld.
+ w addAllMorphs: allMorphs.
+ copyW := w duplicate.
+ allMorphs withIndexDo: [:m :idx | (allOwners at: idx) addMorph: m].
+ w delete.
+ s := SelectionMorph new.
+ s bounds: copyW bounds.
+ s selectSubmorphsOf: copyW.
+ ^ s!
Item was changed:
----- Method: KedamaMorph>>isVisible: (in category 'private') -----
isVisible: examplerPlayer
| turtleMorph |
turtleMorph := examplerPlayer costume.
turtleMorph visible ifFalse: [^ false].
+ turtleMorph world ifNil: [^ false].
turtleMorph owner isRenderer ifFalse: [^ true].
^ turtleMorph owner visible.
!
Item was changed:
----- Method: KedamaMorph>>offerCostumeViewerMenu: (in category 'menu') -----
offerCostumeViewerMenu: aMenu
aMenu add: 'add a new patch variable' translated action: #newPatch.
aMenu balloonTextForLastItem: 'Add a new patch variable' translated.
aMenu add: 'add a new breed of turtle' translated action: #newTurtle.
aMenu balloonTextForLastItem: 'Add a new turtle' translated.
aMenu addLine.
+ aMenu add: 'gather patches and turtles' translated action: #gatherPatchesAndTurtles.
+ aMenu balloonTextForLastItem: 'Show all turtles next to me' translated.
!
Item was added:
+ ----- Method: KedamaMorph>>patches (in category 'accessing') -----
+ patches
+
+ ^ patchesToDisplay!
Item was added:
+ ----- Method: KedamaMorph>>turtles (in category 'accessing') -----
+ turtles
+
+ ^ turtlesDict keys!
Item was added:
+ ----- Method: KedamaPatchMorph>>veryDeepInner: (in category 'as yet unclassified') -----
+ veryDeepInner: deepCopier
+ "the state of a Kedama patch is held in its forms, so we need to "
+ form := form deepCopy.
+ displayForm := displayForm deepCopy.
+ tmpForm := tmpForm deepCopy.
+ super veryDeepInner: deepCopier.!
Item was added:
+ ----- Method: Player>>allPatchAndTurtleMorphs (in category 'slot-kedama') -----
+ allPatchAndTurtleMorphs
+
+ self costume ifNil: [^ #()].
+ ^ self costume patches, (self costume turtles collect: #costume)!
Item was added:
+ ----- Method: Player>>gatherPatchesAndTurtles (in category 'slot-kedama') -----
+ gatherPatchesAndTurtles
+
+ | position |
+ self costume owner ifNil: [^ self].
+ position := self costume topRight + (5@0).
+ self allPatchAndTurtleMorphs do: [:m |
+ m ifNotNil: [
+ m position: position.
+ self costume owner addMorph: m.
+ m visible: true.
+ position := position + (0@(m height + 5))]].!
Item was added:
+ ----- Method: UniclassScript>>veryDeepFixupWith: (in category 'copying') -----
+ veryDeepFixupWith: deepCopier
+
+ super veryDeepFixupWith: deepCopier.
+ self flag: #todo. "Textually coded scripts may also have to be adapted"
+ Project current addDeferredUIMessage: [
+ "We do this in a deferred way, because the deep copying may non-deterministically
+ be in a state where not all referenced players already have copies, so then we recompile the
+ script, but we still reference the wrong players!! - tfel,jl"
+ self recompileScriptFromTilesUnlessTextuallyCoded].!
Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.255.mcz
==================== Summary ====================
Name: EToys-tfel.255
Author: tfel
Time: 27 September 2016, 3:44:53.921268 pm
UUID: 76eaa9ec-bd5b-7c48-b15a-fff14d6af1ee
Ancestors: EToys-tfel.254
pretend uniclasses have an environment, to make the compilation paths work
=============== Diff against EToys-tfel.254 ===============
Item was removed:
- ----- Method: Player class>>category (in category 'organization') -----
- category
-
- ^ super category ifNil: [self categoryForUniclasses]!
Item was added:
+ ----- Method: Player class>>environment (in category 'organization') -----
+ environment
+
+ ^ self isUniClass
+ ifTrue: [(Environment withName: 'EtoysUserDefinedTempEnvironment')
+ at: self name put: self;
+ yourself]
+ ifFalse: [super environment]!