tree-diff-language: remove the magic _THIS_ and _CHILD_ construct

at first, this seemed like a good idea, but it caused already
numerous quirks and headache all over the place. And now, with
the intent to switch to the TreeMutator based implementation,
it would be damn hard to retain these features, if at all
possible.

Thus let's ditch those in time and forget about it!
This commit is contained in:
Fischlurch 2016-09-05 04:04:02 +02:00
parent 840d9e4397
commit 7a29e260e9
3 changed files with 73 additions and 9 deletions

View file

@ -134,8 +134,8 @@ namespace test{
, pick(CHILD_A)
, skip(CHILD_T)
, del(CHILD_T)
, pick(Ref::CHILD) // pick a child anonymously
, mut(Ref::THIS) // mutate the current element (the one just picked)
, after(Ref::END) // accept anything beyond as-is
, mut(SUB_NODE)
, ins(ATTRIB3)
, ins(ATTRIB_NODE) // attributes can also be nested objects
, find(CHILD_A)
@ -153,7 +153,7 @@ namespace test{
, ins(CHILD_A)
, ins(CHILD_A)
, emu(ATTRIB_NODE)
, emu(Ref::THIS)
, emu(SUB_NODE)
});
}

View file

@ -8157,7 +8157,7 @@ As said, this turns out to be a tricky challenge: implementing the application o
** how to open a nested scope for recursive mutation
</pre>
</div>
<div title="TreeDiffModel" creator="Ichthyostega" modifier="Ichthyostega" created="201410270313" modified="201608291945" tags="Model GuiPattern spec draft" changecount="64">
<div title="TreeDiffModel" creator="Ichthyostega" modifier="Ichthyostega" created="201410270313" modified="201609050153" tags="Model GuiPattern spec draft" changecount="65">
<pre>for the purpose of handling updates in the GUI timeline display efficiently, we need to determine and represent //structural differences//
This leads to what could be considered the very opposite of data-centric programming. Instead of embody »the truth« into a central data model with predefined layout, we base our achitecture on a set of actors and their collaboration. In the mentioned example this would be the high-level view in the Session, the Builder, the UI-Bus and the presentation elements within the timeline view. Underlying to each such collaboration is a shared conception of data. There is no need to //actually represent that data// -- it can be conceived to exist in a more descriptive, declarative [[external tree description (ETD)|ExternalTreeDescription]]. In fact, what we //do represent// is a ''diff'' against such an external rendering.
@ -8217,8 +8217,7 @@ In addition, in a future extension, we might consider to introduce up/down foldi
Since the bracketing construct for mutation of child structures bears the ID of the parent, a certain degree of leeway is introduced. In theory, we could always open such a bracketing construct right after the {{{pick}}} token accepting the parent -- yet, while minimal, such a strictly depth-first representation would be hard to read -- so we allow to group the recursive treatement of children //post-fix,// after the messages for the current node. In a similar vein, we introduce another token to describe a //short-cut://
*{{{after}}}(node-ID) : fast-forward through the sequence of elements at current level until the position after the designated element.
To complement this language construct, we define some special, magical (meta) element-~IDs
*{{{_CHILD_}}} : marks an //unnamed// ID. Mostly, the implementation exploits this specific marker to distinguish between nodes which are (named) attributes of an object, and real children
*{{{_THIS_}}} : can be used to refer to the immediately preceding element without knowing its name. Typically used to open a {{{mut(_THIS_)}}} ... {{{emu(_THIS_)}}} bracket to populate a newly inserted object
*{{{_CHILD_}}} : marks an //unnamed// ID. The implementation exploits this specific marker to distinguish between nodes which are (named) attributes of an object, and real children.
*{{{_ATTRIBS_}}} : can be used to jump {{{after(_ATTRIBS_)}}} when mutating the contents of an object. So the following diff verbs will immediately start working on the children
*{{{_END_}}} : likewise can be used to jump {{{after(_END_)}}} to start appending new elements without caring for the existing current content.
All these additional language constructs aren't strictly necessary, but widen the usability of the langauge, also to cover the description of incomplete or fuzzy diffs.

View file

@ -1883,7 +1883,7 @@
<node CREATED="1456430363599" ID="ID_1608232847" MODIFIED="1456505525321" TEXT="erlaube typ-gefilterte Kinder"/>
</node>
</node>
<node CREATED="1456506101544" HGAP="4" ID="ID_133511037" MODIFIED="1473014933091" TEXT="Implementierung" VSHIFT="16">
<node CREATED="1456506101544" HGAP="4" ID="ID_133511037" MODIFIED="1473040740444" TEXT="Implementierung" VSHIFT="16">
<icon BUILTIN="pencil"/>
<node CREATED="1456506128581" HGAP="-12" ID="ID_322289358" MODIFIED="1473014961683" TEXT="Abw&#xe4;gungen" VSHIFT="184">
<node CREATED="1456506135028" FOLDED="true" HGAP="29" ID="ID_470489868" MODIFIED="1472830010078" TEXT="Indirektionen" VSHIFT="-5">
@ -5380,8 +5380,16 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1472216265486" ID="ID_1774905589" MODIFIED="1472495973662" TEXT="sp&#xe4;ter re-evaluieren (Ticket #996)">
<node CREATED="1472216306208" ID="ID_310892577" MODIFIED="1472216342802" TEXT="AFTER">
<arrowlink DESTINATION="ID_1957591180" ENDARROW="Default" ENDINCLINATION="-27;14;" ID="Arrow_ID_228215960" STARTARROW="None" STARTINCLINATION="139;3;"/>
<node CREATED="1473040688153" ID="ID_979711393" MODIFIED="1473040722530" TEXT="bleibt vorerst erhalten">
<icon BUILTIN="yes"/>
</node>
<node CREATED="1472219973288" ID="ID_587190582" MODIFIED="1472219978578" TEXT="Ref::THIS">
<node CREATED="1473040705207" ID="ID_14067702" MODIFIED="1473040710378" TEXT="kann sinnvoll implementiert werden"/>
<node CREATED="1473040711582" ID="ID_1480176374" MODIFIED="1473040717859" TEXT="ist sehr n&#xfc;tzlich">
<icon BUILTIN="ksmiletris"/>
</node>
</node>
<node CREATED="1472219973288" ID="ID_587190582" MODIFIED="1473040470789" TEXT="Ref::THIS">
<icon BUILTIN="button_cancel"/>
<node CREATED="1472220009699" ID="ID_1534445515" MODIFIED="1472220054293">
<richcontent TYPE="NODE"><html>
<head>
@ -5395,11 +5403,68 @@
</html></richcontent>
<icon BUILTIN="yes"/>
</node>
<node CREATED="1473040485789" ID="ID_1621538037" MODIFIED="1473040633258" TEXT="nein: f&#xfc;hrt zu verworrener Implementierung bzw. ist unm&#xf6;glich">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
...denn wir haben nun mehrere Layer,
</p>
<p>
und der Selector kann einfach anhand von Ref::THIS keine sinnvolle Entscheidung treffen.
</p>
<p>
Daher versuchen dann alle Layer dieses Element zu behandeln, oder gar keiner
</p>
<p>
</p>
<p>
Und da der Selector <i>nur die Spec anschauen darf, </i>l&#228;&#223;t sich das auch nachher nicht mehr korrigieren
</p>
<p>
</p>
<p>
Daher habe ich mich <b>entschlossen, dieses Sprachkonstrukt zu entfernen</b>
</p>
</body>
</html>
</richcontent>
</node>
<node CREATED="1472216312295" ID="ID_149667448" MODIFIED="1472216316395" TEXT="Ref::CHILD">
<node CREATED="1473040662653" ID="ID_397737711" MODIFIED="1473040680738">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
<b>entfernt</b>, da schlechtes Design
</p>
</body>
</html></richcontent>
</node>
</node>
<node CREATED="1472216312295" ID="ID_149667448" MODIFIED="1473040473636" TEXT="Ref::CHILD">
<icon BUILTIN="button_cancel"/>
<node CREATED="1472219981838" ID="ID_117724515" MODIFIED="1472219987506" TEXT="was genau soll das sein??"/>
<node CREATED="1472219987983" ID="ID_555190066" MODIFIED="1472219997032" TEXT="was ist der Unterschied zu Ref::THIS"/>
<node CREATED="1472219998405" ID="ID_1294425222" MODIFIED="1472220005255" TEXT="funktioniert das &#xfc;berhaupt noch??"/>
<node CREATED="1473040662653" ID="ID_1838404392" MODIFIED="1473040680738">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
<b>entfernt</b>, da schlechtes Design
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
</node>