Skip to content

Commit

Permalink
experimental code for issue #32
Browse files Browse the repository at this point in the history
code that swaps two classes, exchanges their names and lets the second class
adopt all instances of the other
  • Loading branch information
lauritzthamsen committed Jan 19, 2013
1 parent 61d5045 commit e90382e
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/TraitClasses-Experiments.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
method1

^ 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state11: anObject
state1 := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state11
^ state1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state3: anObject
state3 := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state3
^ state3
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"class" : {
},
"instance" : {
"method1" : "lt 1/19/2013 11:27:30.263",
"state11" : "lt 1/19/2013 11:27:18.701999999999998",
"state11:" : "lt 1/19/2013 11:27:18.709",
"state3" : "lt 1/19/2013 11:42:39.181",
"state3:" : "lt 1/19/2013 11:42:39.186" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "TraitClasses-Experiments",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"state1",
"state3" ],
"name" : "MyClass",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
method2

^ 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state2: anObject
state2 := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
state2
^ state2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"class" : {
},
"instance" : {
"method2" : "lt 1/19/2013 11:27:36.038",
"state2" : "lt 1/19/2013 11:27:48.717",
"state2:" : "lt 1/19/2013 11:27:54.455" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "TraitClasses-Experiments",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"state2" ],
"name" : "MyTraitedClass",
"pools" : [
],
"super" : "MyClass",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
as yet unclassified
class: classA be: classB

| firstClass firstClassName secondClass secondClassName |
firstClass := classA.
firstClassName := classA name asSymbol.
secondClass := classB.
secondClassName := classB name asSymbol.

firstClass setName: secondClassName.
secondClass setName: firstClassName.

Smalltalk
at: firstClassName put: secondClass;
at: secondClassName put: firstClass.

secondClass updateInstancesFrom: firstClass.

"firstClass allInstances do: [:each |
secondClass adoptInstance: each from: firstClass ].
secondClass allInstances do: [:each |
secondClass adoptInstance: each from: firstClass ]."

"firstClass allInstances do: [:each|
each primitiveChangeClassTo: secondClass].
secondClass allInstances do: [:each|
each primitiveChangeClassTo: firstClass]."
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"class:be:" : "lt 1/19/2013 11:38:39.184" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "TraitClasses-Experiments",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"state2" ],
"name" : "TraitUtility",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #'TraitClasses-Experiments'!
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'TraitClasses-Experiments')
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'TraitClasses-Experiments-lt.1' message 'experiment for issue #32, code that swaps two classes, exchanges their names and lets the second class adopt all instances of the other' id 'bdc59159-b997-478b-8b17-cb1758d8ddab' date '19 January 2013' time '11:48:13.16 am' author 'lt' ancestors () stepChildren ())
2 changes: 2 additions & 0 deletions packages/TraitClasses-Experiments.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}

0 comments on commit e90382e

Please sign in to comment.