dr-geo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dr. Geo] Summary of DrGeo conflicts with Pharo


From: Oscar Nierstrasz
Subject: [Dr. Geo] Summary of DrGeo conflicts with Pharo
Date: Fri, 12 Apr 2024 08:20:21 +0200

For the record, here is the complete list of Pharo incompatibilities that I had to fix just to lad the DrGeo code into GT. Of course the code does not run, but at least it loads now so we can explore it.

These are the Pharo incompatibilities that I had to patch to file DrGeo  into GT. It would be great of as many of these as possible could be already fixed in DrGeo itself. Many of them should be trivial and have no impact on DrGeo itself (namely 4, 5, 7 and 8).

(0) These are already fixed
— Parse errors due to `_` being used instead of `:=`. 
— Errors due to the `::` syntax extension of Cui Smalltalk.

(1) There are a number of missing classes that are subclassed or otherwise referred to. We add empty dummy classes:

`#(ActiveModel LayoutMorph DebuggerWindow WizardPanel DialogPanel Panel BoxedMorph MorphDummy PreferenceType Debugger MorphicEruditeDocRenderer PreferenceBrowserVisitor Theme DarkTheme)`

(2) `DrGMorph` adds a `color` slot, but Pharo {{gtClass:name=Morph}} already has one. We remove the `color` slot.
```
aString
copyReplaceAll: 'drawable mathItem color style labelMorph'
with: 'drawable mathItem style labelMorph'
```

(3) Already fixed — spaces in symbols within `DrGDebuggerWindow>>#customButtonSpecs`. 

(4) The Cuis ` optimization syntax is invalid in Pharo. We replace pairs of backquotes with parentheses. There are 28 lines using this feature, but it seems fully unnecessary. We patch them as follows:
```
patchBackquotesIn: aString
| parts |
parts := $` split: aString.
self assert: parts size odd.
^ ''
join: (parts
withIndexCollect: [ :p :i | i > 1 ifTrue: [ i even ifTrue: [ '(' , p ] ifFalse: [ ')' , p ] ] ifFalse: [ p ] ])
```

(5) The fileIn overrides {{gtMethod:name=Class>>#subclass:instanceVariableNames:classVariableNames:package:}}. This breaks Pharo! We rename it in the fileIn by preceding the method name with a `$x`.

(6) `DrGeoSystem>>#initialize` contains this code which we comment out:

`EruditeMarkupGrammar addCodeAction: 'withDrGeoActions'`

(7) We get several `nil does not exist`  errors. It turns out that there are several classes in the fileIn with: poolDictionaries: 'nil'
We change them to: poolDictionaries: ''

(8) There are several other class extensions to core Pharo classes (such as `LinkedList`) that interfere with Pharo methods. This poses a problem for  unloading the code. (To be checked which ones are just extensions and which ones replace existing Pharo methods.)

This is the repo I am using for the experiments, and which contains the code to patch DrGeo: https://github.com/feenkcom/gt4DrGeo
This is a repo containing the patched code already loaded: https://github.com/feenkcom/DrGeoSrc

Cheers,
Oscar
---
oscar.nierstrasz@feenk.com
https://feenk.com/about/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]