Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
valuesportinglog [2022/01/31 13:00]
christian [FileIn 3]
valuesportinglog [2022/02/01 19:34]
christian [FileIn 7 - Tests]
Line 141: Line 141:
  localChanges: self valuesLocalTransform  localChanges: self valuesLocalTransform
 </code> </code>
 +
 +Published as **[Squeak Fileout PDFtalk] (3.0.0.5,chaider)** with the updated transformation.
 +
 +===== FileIn 4 =====
 +
 +FileOut from VW, then fileIn into a fresh Squeak image.
 +
 +Loads about 97% until it hits the error that Timestamp is not defined.
 +
 +The Transcript shows:
 +<code Smalltalk>
 +UndefinedObject>>DoIt (Timestamp is Undeclared) 
 +UndefinedObject>>DoIt (Timestamp is Undeclared) 
 +UndefinedObject>>DoIt (Timestamp is Undeclared) 
 +UndefinedObject>>DoIt (Timestamp is Undeclared) 
 +UndefinedObject>>DoIt (Timestamp is Undeclared) 
 +</code>
 +
 +We do the same trick as in FileIn x and set DateAndTime as superclass of Timestamp. The new Transformation is:
 +
 +<code Smalltalk>
 +ValuesTransform
 + ^PackageChange
 + unusedClasses: #(#{Smalltalk.GeneralBindingReference})
 + newSuperclasses: (Valuemap
 + with: #{Smalltalk.ColorValue} -> #Color
 + with: #{Timestamp} -> #DateAndTime)
 + hierarchyChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.Value}
 + classChanges: (Array with: (Rewrite method: #localSpecification rule: #replaceLiteralBindingWithPath))))
 + localChanges: self valuesLocalTransform
 +</code>
 +
 +Published as **[Squeak Fileout PDFtalk] (3.0.0.6,chaider)** with the updated transformation.
 +
 +===== FileIn 5 =====
 +
 +FileOut from VW, then fileIn into a fresh Squeak image.
 +
 +Loads without errors or warnings!.
 +
 +<HTML>
 +First milestone: <span style="background-color:yellow;font-size:150%;border:2px solid lightgray;">Clean fileIn without errors or warnings!</span><br><br>
 +</HTML>
 +
 +Next step: fileIn the tests.
 +
 +===== FileIn 6 - Tests =====
 +
 +Added Squeak class method ''#fileOutValuesTesting'' analog to ''#fileOutValues'':
 +
 +<code Smalltalk>fileOutValuesTesting
 + self
 + write: ('.' asFilename construct: 'ValuesTesting.Squeak.st')
 + pundles: (Array with: (Store.Registry packageNamed: #'Values Testing'))
 + package: #'Values-Testing'
 + prerequisites: nil
 + packageChanges: (Valuemap with: 'Values Testing' -> self ValuesTestingTransform)
 +</code>
 +
 +with the standard transformation for Value classes:
 +
 +<code Smalltalk>
 +ValuesTestingTransform
 + ^PackageChange hierarchyChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.Value}
 + classChanges: (Array with: (Rewrite method: #localSpecification rule: #replaceLiteralBindingWithPath))))
 +</code>
 +
 +FileOut from VW with:
 +
 +<code Smalltalk>Squeak fileOutValuesTesting</code>
 +
 +then fileIn into a Squeak image  with Values loaded.
 +
 +Loads without errors.
 +
 +The Transcript shows:
 +<code Smalltalk>
 +ValuemapTests>>testIndexedAccess (SubscriptOutOfBoundsError is Undeclared) 
 +ValuemapTests>>testIndexedAccess (SubscriptOutOfBoundsError is Undeclared) 
 +ValuemapTests>>testIndexedAccess (NonIntegerIndexError is Undeclared) 
 +ValuemapTests>>testIndexedAccess (NonIntegerIndexError is Undeclared) 
 +ValuemapTests>>testKeyedAccess (NotFoundError is Undeclared) 
 +ValuemapTests>>testRemoving (NotFoundError is Undeclared) 
 +ValuemapTests>>testRemoving (NotFoundError is Undeclared) 
 +ValuemapTests>>testRemoving (NotFoundError is Undeclared) 
 +ValuemapTests>>testRemoving (NotFoundError is Undeclared) 
 +</code>
 +
 +The VW error classes are not known in Squeak. We define a rewrite of the three test methods:
 +
 +<code Smalltalk>
 +ValuesTestingTransform
 + ^PackageChange
 + hierarchyChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.Value}
 + classChanges: (Array with: (Rewrite method: #localSpecification rule: #replaceLiteralBindingWithPath))))
 + localChanges: (Array with: (ClassChange
 + classReference: #{Smalltalk.ValuemapTests}
 + instanceChanges: ((OrderedCollection new)
 + add: (Rewrite method: #testIndexedAccess rule: #replaceSqueakErrorClasses);
 + add: (Rewrite method: #testKeyedAccess rule: #replaceSqueakErrorClasses);
 + add: (Rewrite method: #testRemoving rule: #replaceSqueakErrorClasses);
 + yourself)))
 +</code>
 +
 +The rule ''#replaceSqueakErrorClasses'' in class ''ParseTreeRewriter'' (analog to ''#replaceGemstoneErrorClasses'') replaces the Error classes by string replacement:
 +
 +<code Smalltalk>
 +replaceSqueakErrorClasses
 + ^(self new)
 + replace: SubscriptOutOfBoundsError name asString with: #Error asString;
 + replace: NonIntegerIndexError name asString with: #Error asString;
 + replace: NotFoundError name asString with: #NotFound asString;
 + yourself
 +</code>
 +
 +Published as **[Squeak Fileout PDFtalk] (3.0.0.7,chaider)** with the updated transformation.
 +===== FileIn 7 - Tests =====
 +
 +FileOut [Values] and [Values Testing], then fileIn into a fresh Squeak image.
 +
 +Loads without errors or warnings!
 +
 +<HTML>
 +2. milestone: <span style="background-color:yellow;font-size:150%;border:2px solid lightgray;">Clean fileIn of the tests without errors or warnings!</span><br><br>
 +</HTML>
 +
 +Test results:
 +25 run in 0:00:00:00, 0 passes, 0 expected failures, 1 failures, 24 errors, 0 unexpected passes
 +
 +
  • valuesportinglog.txt
  • Last modified: 2022/02/27 13:34
  • by christian