[Cuis-dev] Turning morphs back into source code

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sat Nov 23 15:39:35 PST 2024


On 2024-11-21 07:26, Ian Jeffries via Cuis-dev wrote:

> I'm experimenting with turning morphs created via direct manipulation 
> back into source code and am looking for some tips.

Hi Ian.  Glad you are interested in this.  Live Morph -> Source would be 
quite handy.

Apologies for late reply.  Local chaos here, best not to ask..

> As an example use case: I'm making a world map and would like to put my 
> house in it. The image will be pretty simple: just three or four 
> rectangles for the house, a rectangle for the garage, and a few circles 
> to represent trees. Certainly I could just write this in code, but it 
> seems like more fun to use the direct manipulation features of Morphic 
> to create the scene (duplicate, rotate, etc), then serialize that scene 
> to code.

Question is "what do you want to end up with?".  A new Morph subclass 
which you can then multiply instantiate?  Given required backing code 
(packages) does this require a package to get requirements?  Do you wish 
on the other hand to create a bunch of such Morph composites to be 
shared within a package to share requirements?

> Here's the twist: I'm already familiar with Cuis-UI-Packager which is 
> very cool, but my goal here is different. I'd like the result to be 
> source code, not object files, ideally similar to what I would have 
> written by hand.

Glad you found this.  One refinement here is to fill a hole: I did not 
check for or load required Fonts.  It would be good to add this to the 
Cuis-UI-Packager.

I would think the gist of code writing would be to think of the problem 
as the serializer does.  Do the same structure traversal, but rather 
than interpret serializer actions, compile the code to reproduce the 
structure.

Terms.  Hmmm.. perhaps "sourcification" and "sourcifier"?

You might get some ideas from
   
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-UI/tree/main/metaproperties
and
   
https://github.com/KenDickey/Cuis-Smalltalk-BabySteps/tree/master/IdeaMine

Sorry for the muddy ideas, but perhaps hey will engender some 
inspiration.

Good on you,
-KenD


More information about the Cuis-dev mailing list