Just when it was all going so well.... I started trying to port Pier to
use Magritte with pragmas and hit some issues:
Pier structures are instantiated with snippets of code thus:
addChild: ((PRComponent named: 'children')
componentClass: PRChildrenWidget;
write: 1 using: PRChildrenWidget descriptionLevel;
yourself);
the description is no longer defined on the class side so the above doesn't
work. Superficially a quick solution might be modify the code thus:
addChild: ((PRComponent named: 'children')
componentClass: PRChildrenWidget;
write: 1 using: (PRChildrenWidget *new*) descriptionLevel;
yourself);
However within PRComponent the method PRComponent>>#componentDescription
currently uses the componentClass to generate the descriptions. Again this
could be modified to create an instance and retrieve the descriptions from
the instance. However I started to wonder if there is a better way, rather
than creating numerous temporary instances for extracting the descriptions.
My initial idea is to pass a prototypical instance instance to PRComponent
with the default values set, this would then eliminate the need to create
multiple instances for description retrieval - the descriptions can be
retrieved directly from the prototypical instance. The above code would
then be something like:
addChild: ((PRComponent named: 'children')
prototypeInstance: ((PRChildrenWidget *new*) descriptionLevel: 1; yourself);
yourself);
Then I run into more issues as PRChildrenWidget doesn't currently have
write accessors for described properties (nor do any objects derived from
PRWidget), clearly that could be fixed ... but I'm starting to wonder if
I'm going down a sensible path and the modifications required simply fall
out of having instance-side descriptions or if I'm heading completely in
the wrong direction.
Thoughts?
Nick