add support for Ref::THIS (questionable, #996)
while simple to add into the implementation, this whole feature seems rather qestionable to me now, thus I've added a Ticket to be revisited later. In a nutshell, right here, when implementing the binding layer for STL collections, it is easy to enable the framework to treat Ref::THIS properly, but the *actual implementation* will necessarily be offloaded onto each and every concrete binding implementation. Thus client code would have to add support for an rather obscure shortcut within the Diff language. The only way to avoid this would be to change the semantics of the "match"-lambda: if this binding would rather be a back-translation of implementation data into GenNode::ID values, then we'd be able to implement Ref::THIS natively. But such an approach looks like a way inferiour deisgn to me; having delegated the meaning of a "match" to the client seems like an asset, since it is both natural and opens a lot of flexibility, without adding complexity. For that reason I tend to avoid that shortcut now, in the hope to be able to drop it entirely from the language
This commit is contained in:
parent
7bbfb4bc68
commit
835c43027d
4 changed files with 34 additions and 7 deletions
|
|
@ -66,7 +66,7 @@ namespace diff{
|
|||
const Ref Ref::I ("_I_");
|
||||
const Ref Ref::NO ("_NO_");
|
||||
const Ref Ref::END ("_END_");
|
||||
const Ref Ref::THIS ("_THIS_");
|
||||
const Ref Ref::THIS ("_THIS_"); ////////TICKET #996 : Feature of questionable usefulness. Maybe dispensable?
|
||||
const Ref Ref::CHILD ("_CHILD_");
|
||||
const Ref Ref::ATTRIBS("_ATTRIBS_");
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace diff{
|
|||
* or \c pick or \c find), it is allowed immediately to open the
|
||||
* nested scope with \c mut(Ref::THIS) -- which circumvents the
|
||||
* problem that it is sometimes difficult to know the precise ID,
|
||||
* especially when hand-writing a diff to populate a data structure.
|
||||
* especially when hand-writing a diff to populate a data structure. ////////TICKET #996 : `Ref::THIS` is a questionable feature
|
||||
* - \c emu bracketing construct and counterpart to \c mut(ID). This verb
|
||||
* must be given precisely at the end of the nested scope (it is
|
||||
* not allowed to "return" from the middle of a scope, for sake
|
||||
|
|
|
|||
|
|
@ -149,7 +149,9 @@
|
|||
iterator
|
||||
locate (GenNode const& targetSpec)
|
||||
{
|
||||
if (not collection.empty() and matches (targetSpec, collection.back()))
|
||||
if (not collection.empty()
|
||||
and (Ref::THIS.matches(targetSpec.idi)
|
||||
or matches (targetSpec, collection.back())))
|
||||
return lastElm();
|
||||
else
|
||||
return search (targetSpec, eachElm(collection));
|
||||
|
|
|
|||
|
|
@ -2732,8 +2732,7 @@
|
|||
daß der Client hier eigentlich ein Protokoll implementieren muß.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1458850263688" ID="ID_555018476" MODIFIED="1458850272315" TEXT="Zusammenführen">
|
||||
<node CREATED="1458850294083" ID="ID_393704697" MODIFIED="1458850302901" TEXT="der normale GenNode-Applikator"/>
|
||||
|
|
@ -3390,7 +3389,7 @@
|
|||
</node>
|
||||
</node>
|
||||
<node CREATED="1448063874479" HGAP="43" ID="ID_739054690" MODIFIED="1453546352792" TEXT="UI-Modell" VSHIFT="1"/>
|
||||
<node CREATED="1434128074725" FOLDED="true" HGAP="28" ID="ID_933994138" MODIFIED="1460753607324" TEXT="Diff-System" VSHIFT="1">
|
||||
<node CREATED="1434128074725" FOLDED="true" HGAP="28" ID="ID_933994138" MODIFIED="1460934815823" TEXT="Diff-System" VSHIFT="1">
|
||||
<font NAME="SansSerif" SIZE="14"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1434128278990" ID="ID_106354755" MODIFIED="1434128283641" TEXT="Diff-Darstellung"/>
|
||||
|
|
@ -4612,6 +4611,10 @@
|
|||
<node CREATED="1443734884526" ID="ID_1720972097" MODIFIED="1443734907375" TEXT="gilt postfix"/>
|
||||
<node CREATED="1443734942974" ID="ID_72035627" MODIFIED="1443734946841" TEXT="sonst wie normales MUT"/>
|
||||
<node CREATED="1443734955012" ID="ID_132520838" MODIFIED="1443734972286" TEXT="erlaubt Anlegen + Populieren"/>
|
||||
<node CREATED="1460934541540" ID="ID_789170184" MODIFIED="1460934562112" TEXT="von fragwürdigem Nutzen!">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -5419,7 +5422,29 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#990000" CREATED="1443740543812" ID="ID_1766169268" MODIFIED="1443741858388" TEXT="Tests">
|
||||
<node CREATED="1460934597764" FOLDED="true" HGAP="163" ID="ID_1014666775" MODIFIED="1460934811386" TEXT="Review" VSHIFT="6">
|
||||
<font NAME="SansSerif" SIZE="15"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1460934670043" ID="ID_1299827687" MODIFIED="1460934677134" TEXT="später zu überprüfen">
|
||||
<node CREATED="1460934686017" ID="ID_900313780" MODIFIED="1460934697931" TEXT="Klarheit"/>
|
||||
<node CREATED="1460934698430" ID="ID_1527149180" MODIFIED="1460934702241" TEXT="praktischer Kontext"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1460934704022" ID="ID_369718039" MODIFIED="1460934723329" TEXT="fragwürdig">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1460934726315" ID="ID_865694069" MODIFIED="1460934747260" TEXT="Immutabilität">
|
||||
<node CREATED="1460934748064" ID="ID_321786426" MODIFIED="1460934753060" TEXT="keine klare Linie"/>
|
||||
<node CREATED="1460934753440" ID="ID_44139402" MODIFIED="1460934764386" TEXT="einerseits ja, feste Datenwerte"/>
|
||||
<node CREATED="1460934764830" ID="ID_594837209" MODIFIED="1460934769313" TEXT="dann aber doch Assignment"/>
|
||||
<node CREATED="1460934771253" ID="ID_1299180901" MODIFIED="1460934782511" TEXT="und ein Gemurkse bei den Records"/>
|
||||
</node>
|
||||
<node CREATED="1460934785067" ID="ID_945933568" MODIFIED="1460934792557" TEXT="Abkürzungen in der Sprache">
|
||||
<node CREATED="1460934793738" ID="ID_1602968303" MODIFIED="1460934798453" TEXT="Ref::CHILD"/>
|
||||
<node CREATED="1460934799137" ID="ID_1189559717" MODIFIED="1460934801653" TEXT="Ref::THIS"/>
|
||||
<node CREATED="1460934802385" ID="ID_961490107" MODIFIED="1460934807556" TEXT="Ref::ATTRIBS"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#990000" CREATED="1443740543812" HGAP="17" ID="ID_1766169268" MODIFIED="1460934606704" TEXT="Tests" VSHIFT="20">
|
||||
<font NAME="SansSerif" SIZE="14"/>
|
||||
<node CREATED="1443740549220" ID="ID_167459949" MODIFIED="1443740564198" TEXT="List-Diff">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue