From bdf48e1b7bedb98d7cbbda7cf412460447fb4b9d Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 26 Feb 2016 22:57:49 +0100 Subject: [PATCH] WIP: desperate attempt to get out of the design deadlock Arrrrgh. I go round in circles since hours now. Whatever I attempt, it again relies on yet further unsecured suppositions --- src/lib/diff/tree-mutator.hpp | 2 +- tests/15library.tests | 9 +- .../diff-virtualised-application-test.cpp | 2 +- .../diff/tree-manipulation-binding-test.cpp | 122 +++++++++++ ...mutator-test.cpp => tree-mutator-test.cpp} | 8 +- tests/library/variant-test.cpp | 2 +- wiki/thinkPad.ichthyo.mm | 201 ++++++++++++++++-- 7 files changed, 317 insertions(+), 29 deletions(-) create mode 100644 tests/library/diff/tree-manipulation-binding-test.cpp rename tests/library/diff/{generic-tree-mutator-test.cpp => tree-mutator-test.cpp} (93%) diff --git a/src/lib/diff/tree-mutator.hpp b/src/lib/diff/tree-mutator.hpp index 25e44f57a..cc82d346c 100644 --- a/src/lib/diff/tree-mutator.hpp +++ b/src/lib/diff/tree-mutator.hpp @@ -41,7 +41,7 @@ ** can be replaced by a binding closure, which allows to invoke arbitrary code in the ** context of the given object's implementation internals. ** - ** @see generic-tree-mutator-test.cpp + ** @see tree-mutator-test.cpp ** @see DiffDetector ** */ diff --git a/tests/15library.tests b/tests/15library.tests index f19fddee8..1e44e52ed 100644 --- a/tests/15library.tests +++ b/tests/15library.tests @@ -287,8 +287,13 @@ return: 0 END -TEST "Generic recursive mutation with closure binding" GenericTreeMutator_test < > +PLANNED "Generic mapping of changes to tree data" TreeManipulationBinding_test < > out-lit: "data" closure received something that would be acceptable out-lit: localData changed to: that would be acceptable return: 0 diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index d67544781..ef7a740a0 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -81,7 +81,7 @@ namespace test{ * what these elements actually are and how they are to be handled. * - we recurse into mutating such an _"unspecified"_ child element. * @see DiffTreeApplication_test generic variant of tree diff application - * @see GenericTreeMutator_test base operations of the adapter + * @see TreeMutator_test base operations of the adapter * @see tree-diff-mutator-binding.hpp * @see diff-tree-application.hpp * @see tree-diff.hpp diff --git a/tests/library/diff/tree-manipulation-binding-test.cpp b/tests/library/diff/tree-manipulation-binding-test.cpp new file mode 100644 index 000000000..41947aada --- /dev/null +++ b/tests/library/diff/tree-manipulation-binding-test.cpp @@ -0,0 +1,122 @@ +/* + TreeManipulationBinding(Test) - techniques to map generic changes to concrete tree shaped data + + Copyright (C) Lumiera.org + 2016, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "lib/test/run.hpp" +#include "lib/format-util.hpp" +#include "lib/test/test-helper.hpp" +#include "lib/diff/tree-mutator.hpp" +#include "lib/format-cout.hpp" +#include "lib/util.hpp" + +//#include +#include +//#include + +using util::isnil; +using std::string; +//using std::vector; +//using std::swap; + +using util::typeStr; + + +namespace lib { +namespace diff{ +namespace test{ + +// using lumiera::error::LUMIERA_ERROR_LOGIC; + + namespace {//Test fixture.... + + + + }//(End)Test fixture + + + + + + + + + + /********************************************************************************//** + * @test Building blocks to map generic changes to arbitrary private data structures. + * - use a dummy diagnostic implementation to verify the interface + * - integrate the standard case of tree diff application to `Rec` + * - verify an adapter to apply structure modification to a generic collection + * - use closures to translate mutation into manipulation of private attribues + * + * @see TreeMutator + * @see TreeMutator_test + * @see DiffTreeApplication_test + * @see GenNodeBasic_test + * @see AbstractTangible_test::mutate() + */ + class TreeManipulationBinding_test : public Test + { + + virtual void + run (Arg) + { + mutateDummy(); + mutateGenNode(); + mutateCollection(); + mutateAttributeMap(); + } + + + void + mutateDummy() + { + } + + + void + mutateGenNode() + { + TODO ("define how to fit GenNode tree mutation into the framework"); + } + + + void + mutateCollection() + { + TODO ("define how to map the mutation primitives on a generic collection"); + } + + + void + mutateAttributeMap () + { + TODO ("define how to translate generic mutation into attribute manipulation"); + } + }; + + + /** Register this test class... */ + LAUNCHER (TreeManipulationBinding_test, "unit common"); + + + +}}} // namespace lib::diff::test diff --git a/tests/library/diff/generic-tree-mutator-test.cpp b/tests/library/diff/tree-mutator-test.cpp similarity index 93% rename from tests/library/diff/generic-tree-mutator-test.cpp rename to tests/library/diff/tree-mutator-test.cpp index 251b682d8..5b80eb738 100644 --- a/tests/library/diff/generic-tree-mutator-test.cpp +++ b/tests/library/diff/tree-mutator-test.cpp @@ -1,5 +1,5 @@ /* - GenericTreeMutator(Test) - customisable intermediary to abstract tree changing operations + TreeMutator(Test) - customisable intermediary to abstract tree changing operations Copyright (C) Lumiera.org 2015, Hermann Vosseler @@ -67,10 +67,10 @@ namespace test{ * * @see TreeMutator * @see GenNodeBasic_test - * @see GenNodeBasic_test + * @see GenericRecordRepresentation_test * @see GenericTreeRepresentation_test */ - class GenericTreeMutator_test : public Test + class TreeMutator_test : public Test { virtual void @@ -123,7 +123,7 @@ namespace test{ /** Register this test class... */ - LAUNCHER (GenericTreeMutator_test, "unit common"); + LAUNCHER (TreeMutator_test, "unit common"); diff --git a/tests/library/variant-test.cpp b/tests/library/variant-test.cpp index 595300d9f..3532919c1 100644 --- a/tests/library/variant-test.cpp +++ b/tests/library/variant-test.cpp @@ -66,7 +66,7 @@ namespace test{ * @see lib::Variant * @see util::AccessCasted * @see lib::OpaqueHolder - * @see GenericTreeMutator_test + * @see TreeMutator_test */ class Variant_test : public Test { diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index e29ead2f6..5a6775499 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -474,7 +474,7 @@ - + @@ -958,7 +958,7 @@ - + @@ -1083,8 +1083,10 @@ - - + + + + @@ -1145,8 +1147,7 @@ nur Zuweisung einiger Referenzen

- - +
@@ -1179,8 +1180,7 @@ welches bestimmt, ob dieses Attribut angesprochen wird

- - +
@@ -1432,8 +1432,7 @@ reflektiert die Zahl der Struktur-Element

- - +
@@ -1460,8 +1459,7 @@ Also zählen Kinder-Collections nur als ein Strukturelement.

- -
+
@@ -1489,8 +1487,7 @@ duch Bindung bestimmt

- - +
@@ -1503,12 +1500,10 @@ - - - + - - + + @@ -1524,7 +1519,173 @@ - + + + + + + + + + + + + +
    +
  • + Diff-Anwendung wird massiv und in der Breite stattfinden +
  • +
  • + sie wird als Reaktion auf UI-Events auftreten +
  • +
  • + sie dient dazu, andere UI-Operationen einzusparen +
  • +
  • + also muß speziell das Traversieren bis an den Anwendungsort bedacht werden +
  • +
+ + +
+
+ + + + + + +

+ ...d.h. die bis jetzt geschriebene TreeApplikator-Implementierung +

+

+ ist erstaunlich leichtgewichtig. Zu den zwei Indirektionien der Sprache +

+

+ kommt nur entweder ein weiterer aus der GenNode bzw stattedessen ein dynamic cast hinzu. +

+

+ Alles andere steckt in dem expliziten Mutator-Typ +

+

+  -- das gibt einen wichtigen Hinweis -- +

+ + +
+
+ + + + + + +

+ ...da wir eine verb-basierte Sprache implementieren, +

+

+ also einen double-dispatch haben +

+ + +
+
+ + + + + + + + + + + + +

+ weil wir den Anwendungs-Kontext noch überhaupt nicht kennen. +

+

+ Man könnte also später, wenn das ganze System "steht", +

+

+ das Diff-System noch einmal reimplementieren, dann mit einem vorgegebenen Diff-Typ +

+ + +
+
+
+ + + + + + +

+ Beschluß: akzeptiert +

+ + +
+ +
+
+ + + + + + + + +

+ im Sinn von "polymorpic value" ist das Backend virtuell +

+ + +
+
+ + + + + + + + + +

+ ....wenngleich auch dieser aus einem Template generiert wird +

+

+ (will sagen, es ist nicht sofort offensichtlich, daß wir jeweils einen Interpreter generieren) +

+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + +