Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
smalltalktransform [2022/01/31 12:24] christian [Rewrite Tool] |
smalltalktransform [2022/02/28 13:51] christian [Get startet] |
||
---|---|---|---|
Line 7: | Line 7: | ||
This is the next more general version of the [[GemstoneFileout|Gemstone Fileout]] project. | This is the next more general version of the [[GemstoneFileout|Gemstone Fileout]] project. | ||
- | + | < | |
- | The only working example is the PDFtalk port from VisualWorks to Gemstone. | + | <div style=" |
- | + | A < | |
- | It is intended to cover other dialects (Squeak, Pharo, VAST, (Smalltalk/X; has namespaces)) as well. | + | </ |
- | + | </ | |
- | [Begin | + | |
===== Get startet ===== | ===== Get startet ===== | ||
Load bundle **{Smalltalk Transform Project}** from the [[: | Load bundle **{Smalltalk Transform Project}** from the [[: | ||
- | As Example, load package [Gemstone Fileout PDFtalk] | + | Load also the following packages |
- | ===== Smalltalk is not Smalltalk ===== | + | * [Gemstone Fileout PDFtalk] |
- | + | * [Squeak Fileout PDFtalk] | |
- | While all Smalltalk dialects share the same message sending paradigm with the same basic syntax. Many dialects extended the syntax (VW: namespace and literal bindings, Squeak: dynamic array, Amber: literal dictionaries, | + | * [VASmalltalk |
- | + | These contain | |
- | The basic class library (Object, Number, Collection, Class etc.) with standardized selectors are the same in all dialects. But each one extends the library and classes with their own ways of doing things. | + | |
- | + | ||
- | There are some cross dialect libraries like Glorp. | + | |
- | + | ||
- | The UI, at the other end, is very different in all dialects, so that porting is almost impossible. | + | |
- | + | ||
- | ===== Transformations ===== | + | |
- | + | ||
- | ==== Methods ==== | + | |
- | + | ||
- | The source code is in methods which syntax may be different in the target system. | + | |
- | + | ||
- | There are 3 kinds of changes concerning methods: | + | |
- | * **Ignore** This method of the source system should not be written to the target system. <code Smalltalk> | + | |
- | * **Add** This method is added to the target system. The method does not exist in the target system. <code Smalltalk> | + | |
- | * **Replace** This method of the source system is replaced by the body of the target method <code Smalltalk> | + | |
- | * **Rewrite** The body of the source method is transformed by a Rewrite rule <code Smalltalk> | + | |
- | + | ||
- | **'' | + | |
- | + | ||
- | Example: | + | |
- | + | ||
- | The VW method #isLiteral in Object is: | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | " | + | |
- | recognized by the compiler." | + | |
- | ^false</ | + | |
- | + | ||
- | But in Gemstone, the method should be: (this method is defined as extension to '' | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | ^self literalString notNil</ | + | |
- | + | ||
- | With the transformation | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | classReference: | + | |
- | instanceChanges: | + | |
- | + | ||
- | the following is written out as new method | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | ^self literalString notNil</ | + | |
- | + | ||
- | In case that the target | + | |
- | + | ||
- | + | ||
- | ==== Classes ==== | + | |
- | + | ||
- | Changes related to classes. | + | |
- | + | ||
- | === ClassChange === | + | |
- | + | ||
- | Changes related to classes defined or extended by the package. | + | |
- | + | ||
- | < | + | |
- | classReference: | + | |
- | superclassName: | + | |
- | options: <Array of: String> | + | |
- | instanceChanges: | + | |
- | classChanges: | + | |
- | + | ||
- | **classReference** :: the class of this change | + | |
- | + | ||
- | **superclassName** :: ??? | + | |
- | + | ||
- | **options** :: Gemstone class definition options | + | |
- | + | ||
- | **instanceChanges** :: instance method changes | + | |
- | + | ||
- | **classChanges** :: class method changes | + | |
- | + | ||
- | === SystemClassChange === | + | |
- | + | ||
- | Changes related to classes in the target dialect. | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | className: < | + | |
- | instanceChanges: | + | |
- | classChanges: | + | |
- | + | ||
- | **className** :: The name of the class in the target dialect | + | |
- | + | ||
- | **instanceChanges** :: instance method changes | + | |
- | + | ||
- | **classChanges** :: class method changes | + | |
- | + | ||
- | + | ||
- | ==== Packages ==== | + | |
- | + | ||
- | Changes related to a package or bundle. | + | |
- | + | ||
- | <code Smalltalk> | + | |
- | unusedClasses: | + | |
- | newSuperclasses: | + | |
- | newClassNames: | + | |
- | hierarchyChanges: | + | |
- | localChanges: | + | |
- | extensions: | + | |
- | + | ||
- | **unusedClasses** :: classes not to be filed out | + | |
- | + | ||
- | **newSuperclasses** :: classes with their target dialect superclass | + | |
- | + | ||
- | **newClassNames** :: (preparation for class renamings - not done or used yet) | + | |
- | + | ||
- | **hierarchyChanges** :: class changes for a class hierarchy | + | |
- | + | ||
- | **localChanges** :: class changes for classes defined or extended in the package | + | |
- | + | ||
- | **extensions** :: system class changes for classes only defined in the target system | + | |
- | + | ||
- | + | ||
- | ===== To do ===== | + | |
- | Notes for myself for changes | + | Read in the [[SmalltalkTransformDocumentation|Smalltalk transform documentation]] about the technical details and how to use this tool. |
- | * Class renamings. A project scoped operation where all references to a class must be rewritten | ||
- | * multiple rewrites. Serveral rewrites should be applied to one method source | ||
- | * Dialect namespaces. Each dialect should have it's own namespace so that target code loads without warnings | ||
- | * Usage detection. For recuring transformations, | ||
- | * Define classes first. References to unloaded classes cause an error in Gemstone. Allows forward references. |