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 [2021/07/28 16:22] christian [Translations] |
smalltalktransform [2022/01/31 12:24] christian [Rewrite Tool] |
||
---|---|---|---|
Line 4: | Line 4: | ||
Transformations are declared for each package, class and method. | Transformations are declared for each package, class and method. | ||
- | The transformations are applied some code to generate the target Smalltalk code. | + | The transformations are applied |
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. | ||
Line 10: | Line 10: | ||
The only working example is the PDFtalk port from VisualWorks to Gemstone. | The only working example is the PDFtalk port from VisualWorks to Gemstone. | ||
- | It is intended to cover other dialects (Pharo, | + | It is intended to cover other dialects (Squeak, |
+ | |||
+ | [Begin of 2022] There is the possibility for a project to implement a general port for non-namespace Smalltalk dialects. A **[[PDFtalkNonNamespaceFileout|project page is setup here]]**. | ||
===== Get startet ===== | ===== Get startet ===== | ||
Line 27: | Line 29: | ||
The UI, at the other end, is very different in all dialects, so that porting is almost impossible. | The UI, at the other end, is very different in all dialects, so that porting is almost impossible. | ||
- | ==== Translations | + | ===== Transformations ===== |
- | === Methods === | + | ==== Methods |
The source code is in methods which syntax may be different in the target system. | The source code is in methods which syntax may be different in the target system. | ||
There are 3 kinds of changes concerning methods: | There are 3 kinds of changes concerning methods: | ||
- | * **Ignore** This method of the source system should not be written to the target system. < | + | * **Ignore** This method of the source system should not be written to the target system. < |
- | * **Add** This method is added to the target system. The method does not exist in the source | + | * **Add** This method is added to the target system. The method does not exist in the target |
- | * **Replace** This method of the source system is replaced by the body of the target method< | + | * **Replace** This method of the source system is replaced by the body of the target method < |
- | * **Rewrite** The body of the source method is transformed by a Rewrite rule< | + | * **Rewrite** The body of the source method is transformed by a Rewrite rule < |
+ | |||
+ | **'' | ||
+ | |||
+ | 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 for '' | ||
+ | |||
+ | <code Smalltalk> | ||
+ | ^self literalString notNil</ | ||
+ | |||
+ | In case that the target class is not in the source system, the code is defined in a special placeholder class: **'' | ||
+ | |||
+ | |||
+ | ==== Classes ==== | ||
+ | |||
+ | Changes related to classes. | ||
+ | |||
+ | === ClassChange === | ||
+ | |||
+ | Changes related to classes defined or extended by the package. | ||
+ | |||
+ | <code Smalltalk> | ||
+ | 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 | ||
- | === Classes === | + | **newClassNames** :: (preparation for class renamings - not done or used yet) |
- | === Packages === | + | **hierarchyChanges** :: class changes for a class hierarchy |
- | (to be continued...) | + | **localChanges** :: class changes for classes defined or extended in the package |
- | ==== Rewrite Tool ==== | + | **extensions** :: system class changes for classes only defined in the target system |
- | The code transformations are done with the rewrite tool. | ||
===== To do ===== | ===== To do ===== |