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
smalltalktransform [2022/01/07 06:46]
christian [Smalltalk Transform Project]
smalltalktransform [2022/02/23 16:02]
christian [Smalltalk Transform Project]
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 to some code to generate the target Smalltalk code.
  
 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.+working example is the PDFtalk port from VisualWorks to Gemstone.
  
 It is intended to cover other dialects (Squeak, Pharo, VAST, (Smalltalk/X; has namespaces)) as well. It is intended to cover other dialects (Squeak, Pharo, VAST, (Smalltalk/X; has namespaces)) as well.
  
 [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]]**. [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]]**.
 +
 +The [[SmalltalkTransformDocumentation|Smalltalk transform documentation]] describes all the technical details.
  
 ===== Get startet ===== ===== Get startet =====
Line 29: Line 31:
 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. <code>Ignore method: #asPDF</code> +  * **Ignore** This method of the source system should not be written to the target system. <code Smalltalk>Ignore method: #asPDF</code> 
-  * **Add** This method is added to the target system. The method does not exist in the source system. <code>Add method: #asPDF code: #_gs_asPDF</code> +  * **Add** This method is added to the target system. The method does not exist in the target system. <code Smalltalk>Add method: #asPDF code: #_gs_asPDF</code> 
-  * **Replace** This method of the source system is replaced by the body of the target method<code>Replace method: #asString code: #_gs_asString</code> +  * **Replace** This method of the source system is replaced by the body of the target method <code Smalltalk>Replace method: #asString code: #_gs_asString</code> 
-    * **Rewrite** The body of the source method is transformed by a Rewrite rule<code>Rewrite method: #pdfVersion rule: #replaceDottedName</code>+    * **Rewrite** The body of the source method is transformed by a Rewrite rule <code Smalltalk>Rewrite method: #pdfVersion rule: #replaceDottedName</code> 
 + 
 +**''Add''** and **''Replace''** refer to code in a method private for the target dialect. The body of the ''#code'' method is combined with the selector given by ''#method''
 + 
 +Example: 
 + 
 +The VW method #isLiteral in Object is: 
 + 
 +<code Smalltalk>isLiteral 
 + "Answer whether the receiver has a literal text form  
 + recognized by the compiler." 
 + ^false</code> 
 + 
 +But in Gemstone, the method should be: (this method is defined as extension to ''Object'' in package ''[Gemstone Fileout PDFtalk]''
 + 
 +<code Smalltalk>_gs_isLiteral 
 + ^self literalString notNil</code> 
 + 
 +With the transformation 
 + 
 +<code Smalltalk>ClassChange 
 + classReference: #{Object} 
 + instanceChanges: (Array with: (Add method: #isLiteral code: #_gs_isLiteral))</code> 
 + 
 +the following is written out as new method for ''Object'' in Gemstone: 
 + 
 +<code Smalltalk>isLiteral 
 + ^self literalString notNil</code> 
 + 
 +In case that the target class is not in the source system, the code is defined in a special placeholder class: **''CodeHolder''**. The methods here should have the proper protocol and be on the class or instance side. 
 + 
 + 
 +==== Classes ==== 
 + 
 +Changes related to classes. 
 + 
 +=== ClassChange === 
 + 
 +Changes related to classes defined or extended by the package. 
 + 
 +<code Smalltalk>ClassChange 
 + classReference: <class reference> 
 + superclassName: <Symbol> 
 + options: <Array of: String> 
 + instanceChanges: <Array of: MethodChange> 
 + classChanges: <Array of: MethodChange></code> 
 + 
 +**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>SystemClassChange 
 + className: <Symbol> 
 + instanceChanges: <Array of: MethodChange> 
 + classChanges: <Array of: MethodChange></code> 
 + 
 +**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>PackageChange 
 + unusedClasses: <Array of: class reference> 
 + newSuperclasses: <Dictionary key: class reference value: Symbol> 
 + newClassNames: <???> 
 + hierarchyChanges: <Array of: ClassChange> 
 + localChanges: <Array of: ClassChange> 
 + extensions: <Array of: SystemClassChange></code> 
 + 
 +**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
  
-=== Classes ===+**extensions** :: system class changes for classes only defined in the target system
  
-=== Packages ===+==== Projects ====
  
-(to be continued...)+Changes related to a project with several packages and/or bundles.
  
-==== Rewrite Tool ====+Classes are renamed across the whole project.
  
-The code transformations are done with the rewrite tool.+(to be defined)
  
 ===== To do ===== ===== To do =====
  • smalltalktransform.txt
  • Last modified: 2023/04/12 14:13
  • by christian