Chain-Load: safety problems with rule initialisation
the RandomDraw rules developed last days are meant to be used with user-provided λ-adapters; employing these in a context of a DSL runs danger of producing dangling references. Attempting to resolve this fundamental problem through late-initialisation, and then locking the component into a fixed memory location prior to actual usage. Driven by the goal of a self-contained component, some advanced trickery is required -- which again indicates better to write a library component with adequate test coverage.
This commit is contained in:
parent
5033674b00
commit
1892d1beb5
4 changed files with 448 additions and 12 deletions
106
src/lib/lazy-init.hpp
Normal file
106
src/lib/lazy-init.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
LAZY-INIT.hpp - a self-initialising functor
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2023, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/** @file lazy-init.hpp
|
||||
** Building block to allow delayed initialisation of infrastructure tied to a functor.
|
||||
** This solution is packaged as a mix-in template and engages a hidden mechanism with
|
||||
** considerable trickery. It attempts to solve a problem arising notoriously when building
|
||||
** elaborate processing by composing functions and user-provided configuration lambdas;
|
||||
** the very point of this construction style is to tap into internal context to involve
|
||||
** deep details of the implementation without the need to represent these as structures
|
||||
** on API level. Unfortunately this has the consequence that capture-by-reference is
|
||||
** all over the place, breeding instability. The only solution to defeat this instability
|
||||
** is to lock an enclosing implementation scope into a fixed memory location, which boils
|
||||
** down to using non-copyable classes. This solution may be in conflict to the intended
|
||||
** use, especially when building DSLs, configuration frameworks or symbolic processing,
|
||||
** where entities are _value like_ from a semantic point of view. The solution pursued
|
||||
** here is to define some linkage for operational state, which allows to lock a scope
|
||||
** to a fixed memory location. Assuming that a typical usage scenario will first
|
||||
** require setup, then proceed to processing, this solution attempts to tie
|
||||
** the usage restrictions to the lifecycle — hopefully hiding the concern
|
||||
** from users sight altogether.
|
||||
**
|
||||
** # Initialisation mechanism
|
||||
** This mix-in assumes that there is a function somewhere, which activates the actual
|
||||
** processing, and this processing requires initialisation to be performed reliably
|
||||
** before first use. Thus, a _»trojan functor«_ is placed into this work-function,
|
||||
** with the goal to activate a „trap“ on first use. This allows to invoke the actual
|
||||
** initialisation, which is also configured as a functor, and which is the only part
|
||||
** the client must provide actively, to activate the mechanism.
|
||||
**
|
||||
** There is one _gory detail_ however: the initialisation hook needs the actual instance
|
||||
** pointer valid *at the time of actual initialisation*. And since initialisation shall
|
||||
** be performed automatically, the trap mechanism needs a way to derive this location,
|
||||
** relying on minimal knowledge only. This challenge can only be overcome by assuming
|
||||
** that the »trojan functor« itself is stored somehow embedded into the target object
|
||||
** to be initialised. If there is a fixed distance relation in memory, then the target
|
||||
** can be derived from the self-position of the functor; if this assumption is broken
|
||||
** however, memory corruption and SEGFAULT may be caused.
|
||||
**
|
||||
** @todo 11/2023 at the moment I am just desperately trying to get a bye-product of my
|
||||
** main effort into usable shape and salvage an design idea that sounded clever
|
||||
** on first thought. I am fully aware that »lazy initialisation« is something
|
||||
** much more generic, but I am also aware of the potential of the solution
|
||||
** coded here. Thus I'll claim that generic component name, assuming that
|
||||
** time will tell if we need a more generic framework to serve this
|
||||
** purpose eventually....
|
||||
** @see LazyInit_test
|
||||
** @see lib::RandomDraw usage example
|
||||
** @see vault::gear::TestChainLoad::Rule where this setup matters
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LIB_LAZY_INIT_H
|
||||
#define LIB_LAZY_INIT_H
|
||||
|
||||
|
||||
//#include "lib/error.h"
|
||||
//#include "lib/nocopy.hpp"
|
||||
#include "lib/meta/function.hpp"
|
||||
//#include "lib/meta/function-closure.hpp"
|
||||
//#include "lib/util-quant.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
//#include <functional>
|
||||
//#include <utility>
|
||||
|
||||
|
||||
namespace lib {
|
||||
// namespace err = lumiera::error;
|
||||
|
||||
// using lib::meta::_Fun;
|
||||
// using std::function;
|
||||
// using std::forward;
|
||||
// using std::move;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class LazyInit
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace lib
|
||||
#endif /*LIB_LAZY_INIT_H*/
|
||||
|
|
@ -439,6 +439,10 @@ out-lit: 42
|
|||
END
|
||||
|
||||
|
||||
PLANNED "Lazy init of a functor" LazyInit_test <<END
|
||||
END
|
||||
|
||||
|
||||
TEST "configurable Factory" MultiFact_test <<END
|
||||
END
|
||||
|
||||
|
|
|
|||
107
tests/library/lazy-init-test.cpp
Normal file
107
tests/library/lazy-init-test.cpp
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
LazyInit(Test) - verify a mechanism to install a self-initialising functor
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2023, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
/** @file lazy-init-test.cpp
|
||||
** unit test \ref LazyInit_test
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/lazy-init.hpp"
|
||||
//#include "lib/format-string.hpp"
|
||||
//#include "lib/test/test-helper.hpp"
|
||||
#include "lib/test/diagnostic-output.hpp" /////////////////////TODO TODOH
|
||||
|
||||
//#include <array>
|
||||
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
// using util::_Fmt;
|
||||
// using lib::meta::_FunRet;
|
||||
// using err::LUMIERA_ERROR_LIFECYCLE;
|
||||
|
||||
|
||||
|
||||
namespace { // policy and configuration for test...
|
||||
|
||||
//
|
||||
}//(End) Test config
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************//**
|
||||
* @test Verify a mix-in to allow for lazy initialisation of complex infrastructure
|
||||
* tied to a std::function; the intention is to have a »trap« hidden in the
|
||||
* function itself to trigger on first use and perform the one-time
|
||||
* initialisation, then finally lock the object in place.
|
||||
* @see lazy-init.hpp
|
||||
* @see lib::RandomDraw
|
||||
*/
|
||||
class LazyInit_test
|
||||
: public Test
|
||||
{
|
||||
|
||||
void
|
||||
run (Arg)
|
||||
{
|
||||
simpleUse();
|
||||
|
||||
verify_inlineFunctorStorage();
|
||||
// verify_numerics();
|
||||
// verify_adaptMapping();
|
||||
// verify_dynamicChange();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test demonstrate a basic usage scenario
|
||||
*/
|
||||
void
|
||||
simpleUse()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test verify that std::function indeed stores a simple functor inline
|
||||
*/
|
||||
void
|
||||
verify_inlineFunctorStorage()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Register this test class... */
|
||||
LAUNCHER (LazyInit_test, "unit common");
|
||||
|
||||
|
||||
}} // namespace lib::test
|
||||
|
|
@ -96209,7 +96209,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#fef7b5" DESTINATION="ID_6655140" ENDARROW="Default" ENDINCLINATION="206;-191;" ID="Arrow_ID_1782877370" STARTARROW="None" STARTINCLINATION="-63;175;"/>
|
||||
<arrowlink COLOR="#fef7b5" DESTINATION="ID_6655140" ENDARROW="Default" ENDINCLINATION="159;-197;" ID="Arrow_ID_1782877370" STARTARROW="None" STARTINCLINATION="-63;175;"/>
|
||||
<linktarget COLOR="#fecdd2" DESTINATION="ID_697379621" ENDARROW="Default" ENDINCLINATION="32;-123;" ID="Arrow_ID_854594463" SOURCE="ID_1461707170" STARTARROW="None" STARTINCLINATION="-170;12;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
|
|
@ -96263,7 +96263,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700240155314" ID="ID_6655140" MODIFIED="1700243338694" TEXT="Hilfsmittel: Regel-Builder">
|
||||
<linktarget COLOR="#fef7b5" DESTINATION="ID_6655140" ENDARROW="Default" ENDINCLINATION="206;-191;" ID="Arrow_ID_1782877370" SOURCE="ID_697379621" STARTARROW="None" STARTINCLINATION="-63;175;"/>
|
||||
<linktarget COLOR="#fef7b5" DESTINATION="ID_6655140" ENDARROW="Default" ENDINCLINATION="159;-197;" ID="Arrow_ID_1782877370" SOURCE="ID_697379621" STARTARROW="None" STARTINCLINATION="-63;175;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1700264860430" ID="ID_911248195" MODIFIED="1700713935881" TEXT="nochmal umstülpen....">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -96285,7 +96285,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</body>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#6e6080" DESTINATION="ID_1331338727" ENDARROW="Default" ENDINCLINATION="-87;-56;" ID="Arrow_ID_572043531" STARTARROW="None" STARTINCLINATION="99;6;"/>
|
||||
<linktarget COLOR="#564965" DESTINATION="ID_1812170860" ENDARROW="Default" ENDINCLINATION="-709;47;" ID="Arrow_ID_107668670" SOURCE="ID_1249462296" STARTARROW="None" STARTINCLINATION="-169;-5;"/>
|
||||
<linktarget COLOR="#564965" DESTINATION="ID_1812170860" ENDARROW="Default" ENDINCLINATION="-607;44;" ID="Arrow_ID_107668670" SOURCE="ID_1249462296" STARTARROW="None" STARTINCLINATION="-77;0;"/>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1700264918159" ID="ID_334644013" MODIFIED="1700491041706" TEXT="diesen aber zugleich als Regel-Builder nutzbar machen">
|
||||
<icon BUILTIN="yes"/>
|
||||
|
|
@ -97060,10 +97060,19 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node COLOR="#338800" CREATED="1700491985219" ID="ID_460437503" MODIFIED="1700623393034" TEXT="Adaptierung restrukturieren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1700703950832" ID="ID_1969215603" MODIFIED="1700771307508" TEXT="adaptIn behandelt auch Standard-Fälle">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1700703965086" ID="ID_1155590863" MODIFIED="1700771310273" TEXT="default Args">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1700703995258" ID="ID_96569993" MODIFIED="1700771311187" TEXT="Manipulator-Function">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#75287f" CREATED="1700667013700" ID="ID_1737653728" MODIFIED="1700704194326" TEXT="RandomDraw ◁ NonCopyable">
|
||||
<linktarget COLOR="#b1054b" DESTINATION="ID_1737653728" ENDARROW="Default" ENDINCLINATION="512;-31;" ID="Arrow_ID_685625009" SOURCE="ID_1118038273" STARTARROW="None" STARTINCLINATION="-660;37;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
<node COLOR="#5b280f" CREATED="1700704003148" HGAP="23" ID="ID_1702969215" MODIFIED="1700704096383" TEXT="so nicht umsetzbar" VSHIFT="17">
|
||||
<node COLOR="#5b280f" CREATED="1700704003148" HGAP="25" ID="ID_1702969215" MODIFIED="1700704096383" TEXT="so nicht umsetzbar" VSHIFT="32">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
|
|
@ -97072,9 +97081,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<linktarget COLOR="#ffcdd1" DESTINATION="ID_1702969215" ENDARROW="Default" ENDINCLINATION="-620;68;" ID="Arrow_ID_1851761641" SOURCE="ID_79615506" STARTARROW="None" STARTINCLINATION="296;14;"/>
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
</node>
|
||||
<node CREATED="1700704013432" ID="ID_1448952163" MODIFIED="1700704161448" TEXT="movable until locked">
|
||||
<node CREATED="1700704013432" HGAP="24" ID="ID_1448952163" MODIFIED="1700771385423" TEXT="movable until locked">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
|
|
@ -97084,10 +97094,197 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1700771344602" HGAP="29" ID="ID_1040954114" MODIFIED="1700771381264" TEXT="(löst nicht das Prolem)">
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
<icon BUILTIN="closed"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700771397323" ID="ID_1508566872" MODIFIED="1700771408743" TEXT="brauche re-Konfigurierung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1700771446815" ID="ID_488462675" MODIFIED="1700771465246" TEXT="im DSL-Gebrauch ist es ein value-Objekt"/>
|
||||
<node CREATED="1700771518723" ID="ID_1481914135" MODIFIED="1700771536304">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
zur Anwendung müssen Funktoren <i>gebunden </i>sein
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1700772446358" ID="ID_1414778740" MODIFIED="1700772523740" TEXT="man könnte die Roh-Funktion irgendwo aufbewahren"/>
|
||||
<node CREATED="1700772494639" ID="ID_1137027795" MODIFIED="1700772550820" TEXT="besser: on-demand / lazy initialisieren">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1700772585219" ID="ID_1288514282" MODIFIED="1700772589140" TEXT="Implementierung">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1700772595434" ID="ID_167076178" MODIFIED="1700772600402" TEXT="Idee">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1700772622548" ID="ID_1267008084" MODIFIED="1700772805353" TEXT="Funk-Trojaner">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
In die eigentliche Auswertungsfunktion kann man eine »trojanische Funktion« installieren, die etwas völlig anderes macht, nämlich die Initialisierung. Danach überschreibt sie sich selbst mit der fertig gebundenen Funktion
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1700772657793" ID="ID_577281261" MODIFIED="1700772670690" TEXT="init-Hook dort ablegen"/>
|
||||
<node CREATED="1700772679653" ID="ID_345439582" MODIFIED="1700772699597" TEXT="ersetzt sich selbst"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700772812268" ID="ID_1143957846" MODIFIED="1700772830131" TEXT="Aufbewahren belieiger Funktionen">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1700773163605" ID="ID_1780777902" MODIFIED="1700773325986" TEXT="grundsätztlich ist std::function bereits ein Container">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...mit einem gewissen Grad an Type Erasure; sie haben eine bekannte, feste Größe, egal was man reinpackt, ggfs. aber verwalten sie Heap-Storage transparent
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1700773082172" ID="ID_482286185" MODIFIED="1700773092962" TEXT="man könnte sie in einen OpaqueHolder packen"/>
|
||||
<node CREATED="1700773093950" ID="ID_1695195928" MODIFIED="1700773136964" TEXT="oder einen InPlaceAnyHolder">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
das ist praktisch das Gleiche, beide haben eine VTable, aber der OpaqueHolder baut darauf auf und unterstützt auch Zugriff über das Basis-Interface
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1700773328463" ID="ID_1872463297" MODIFIED="1700773338841" TEXT="oder einfach Heap-Storage verwenden">
|
||||
<node CREATED="1700773344429" ID="ID_297664297" MODIFIED="1700773351404" TEXT="es lebe der shared_ptr">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1700773358783" ID="ID_1846897416" MODIFIED="1700773378052" TEXT="den kann man in eine λ-Closure packen"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1700773390266" ID="ID_1886551153" MODIFIED="1700773400633" TEXT="Struktur">
|
||||
<node CREATED="1700773401885" ID="ID_1582245049" MODIFIED="1700773410488" TEXT="als Base-Template einmischen">
|
||||
<node CREATED="1700773412355" ID="ID_1464118372" MODIFIED="1700773419346" TEXT="dann kann man das ganze Thema wegpacken"/>
|
||||
<node CREATED="1700773419935" ID="ID_1817074035" MODIFIED="1700773434229" TEXT="auch die Copy-Konstruktoren und Assignment-Operatoren sind dort"/>
|
||||
<node CREATED="1700773435601" ID="ID_9733601" MODIFIED="1700773452450" TEXT="denn der Rest von RandomDraw ist ja nun wirklich voll ein Value-Objekt"/>
|
||||
</node>
|
||||
<node CREATED="1700773537595" ID="ID_1432609215" MODIFIED="1700773543190" TEXT="Lebenszyklus">
|
||||
<node CREATED="1700773566103" ID="ID_916457666" MODIFIED="1700773569780" TEXT="prepareInit">
|
||||
<node CREATED="1700773578373" ID="ID_717299946" MODIFIED="1700773589040" TEXT="bekommt die (später zu adaptierende) Funktion"/>
|
||||
<node CREATED="1700773666697" ID="ID_366122838" MODIFIED="1700773674164" TEXT="bekommt einen Initialiser">
|
||||
<node CREATED="1700773675776" ID="ID_1981466667" MODIFIED="1700773816985" TEXT="dieser ist lediglich eine delayed Continuation"/>
|
||||
<node CREATED="1700773817813" ID="ID_1896161271" MODIFIED="1700778636520" TEXT="muß später mit der konkreten Instanz aufgerufen werden"/>
|
||||
<node CREATED="1700773845235" ID="ID_1862822629" MODIFIED="1700773872409">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
init(this) ⟹ this wird <i>fertig gemacht</i>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1700773954759" ID="ID_288410352" MODIFIED="1700773972621" TEXT="installiert die Trap-Door in den Funktor"/>
|
||||
</node>
|
||||
<node CREATED="1700773986279" ID="ID_445146544" MODIFIED="1700773993234" TEXT="trap ⟶ init">
|
||||
<node BACKGROUND_COLOR="#f8f1cb" COLOR="#a50125" CREATED="1700774014699" ID="ID_877534987" MODIFIED="1700774027691" TEXT="Kernproblem: *this erlangen">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node COLOR="#5b280f" CREATED="1700774132659" ID="ID_1314038863" MODIFIED="1700774158621" TEXT="nicht möglich ohne »Trick«">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
<node CREATED="1700774237148" ID="ID_160995692" MODIFIED="1700774245598" TEXT="ein Funktor weiß nichts über seine Umgebung"/>
|
||||
<node CREATED="1700774247047" ID="ID_608977668" MODIFIED="1700774267213" TEXT="Referenz-Bindings helfen uns hier genau garnicht"/>
|
||||
<node CREATED="1700776063690" ID="ID_1342942555" MODIFIED="1700776090893" TEXT="wenn man wüßte daß man in der Function sitzt..."/>
|
||||
<node CREATED="1700776091598" ID="ID_1479396852" MODIFIED="1700776108424" TEXT="...dann könnte man ein Loch graben"/>
|
||||
<node CREATED="1700778116488" ID="ID_159565165" LINK="https://stackoverflow.com/a/77202545/444796" MODIFIED="1700778140742" TEXT="Stichwort: small-object optimisation">
|
||||
<node CREATED="1700778148404" ID="ID_1785863837" MODIFIED="1700778179089" TEXT="der Standard garantiert nur inline-Storage für Funktion-pointer"/>
|
||||
<node CREATED="1700778185671" ID="ID_1789341304" MODIFIED="1700778223890" TEXT="aber alle bekannten Implementierungen speichern kleine Funktorein inline"/>
|
||||
<node CREATED="1700778224858" ID="ID_984729061" MODIFIED="1700778243311" TEXT="die Grenze variiert aber stark; libstdc++ ist ehr restriktiv"/>
|
||||
<node CREATED="1700778290585" ID="ID_665841886" MODIFIED="1700778307814">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<u>Erfahrungswert</u>: ein »Slot« geht immer
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1700778314342" ID="ID_193975153" MODIFIED="1700778601433" TEXT="auf Trickserei einlassen?">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1700778331164" ID="ID_656522056" MODIFIED="1700778336903" TEXT="boooooo"/>
|
||||
<node CREATED="1700778338201" ID="ID_1607404612" MODIFIED="1700778387125" TEXT="die Alternative ist ehr abstoßend">
|
||||
<node CREATED="1700778388717" ID="ID_163265227" MODIFIED="1700778409395" TEXT="...dann müßte nämlich der User von RandomDraw den Lifecycle sicherstellen"/>
|
||||
<node CREATED="1700778410233" ID="ID_1666557118" MODIFIED="1700778442059" TEXT="konkret könnte man das in die Setter einbauen, oder in den Start der Toplologie-Generierung..."/>
|
||||
<node CREATED="1700778461977" ID="ID_943446060" MODIFIED="1700778483796" TEXT="aber es untergräbt die Idee einer Komponente">
|
||||
<node CREATED="1700778504077" ID="ID_1478918380" MODIFIED="1700778515192" TEXT="im Grunde bin ich da schon an der Grenze"/>
|
||||
<node CREATED="1700778515813" ID="ID_537559627" MODIFIED="1700778527816" TEXT="man muß hier eine Menge von der Implementierung verstanden haben"/>
|
||||
<node CREATED="1700778528694" ID="ID_785919557" MODIFIED="1700778552178" TEXT="und um genau das zu verbessern, wollte ich RandomDraw einführen"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1700778564373" ID="ID_1532831328" MODIFIED="1700778598692" TEXT="selber einkapseln; und per Assertion + Test absichern">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1700778699563" ID="ID_1530959927" MODIFIED="1700778715437" TEXT="den Initialiser aufrufen"/>
|
||||
<node CREATED="1700778727919" ID="ID_1658914287" MODIFIED="1700778742161" TEXT="zusätzlich ein "engage" oder "lock" aktivieren"/>
|
||||
<node CREATED="1700778854255" ID="ID_1784136751" MODIFIED="1700778862977" TEXT="die initialisierte Funktion zuweisen"/>
|
||||
<node CREATED="1700778863725" ID="ID_531022608" MODIFIED="1700778875743" TEXT="und schließlich aufrufen, um das tatsächliche Ergebnis zu produzieren">
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1700778929573" ID="ID_346937119" MODIFIED="1700778948786" TEXT="das ist ebenfalls grenzwertig">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node CREATED="1700778980340" ID="ID_1513073706" MODIFIED="1700779203466" TEXT="weil die Zuweisung sehr wahrscheinlich dem laufenden Code die Daten de-alloziert">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
die Trap-Door muß irgendwo auf den Initialiser zugreifen, und dieser muß wiederum die vorläufige Funktion speichern. Alle diese Allokationen müssen direkt am Trap selber »aufgehängt« werden; wenn wir also den Trap verwerfen (durch Neuzuweisung), sägen wir den Ast ab, auf dem wir sitzen. Kann man machen, wenn man Flügel hat, oder sowieso schon auf dem Sprung ist
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1700778952199" ID="ID_1113376718" MODIFIED="1700778979121" TEXT="sollte aber grade noch gehen, wenn nur noch der Tail-Call der Funktion folgt"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1700778751948" ID="ID_306020657" MODIFIED="1700778847979" TEXT="Prinzip: Detail-Wissen über die Funktion soll im Initialiser eingekapselt bleiben"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700779211570" ID="ID_181212829" MODIFIED="1700779288743" TEXT="sauber als Hilfskomponente aufsetzen">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1700779233186" ID="ID_155856101" MODIFIED="1700779259708" TEXT="Begründung: wird schon wieder Komplex und hat ein paar vergrabene Hunde..."/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700779263072" ID="ID_1457586572" MODIFIED="1700779291901" TEXT="lib/lazy-init.hpp">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700779275391" ID="ID_1990626821" MODIFIED="1700779291901" TEXT="LazyInit_test.cpp">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1700703950832" ID="ID_1969215603" MODIFIED="1700703961523" TEXT="adaptIn behandelt auch Standard-Fälle">
|
||||
<node CREATED="1700703965086" ID="ID_1155590863" MODIFIED="1700703994695" TEXT="default Args"/>
|
||||
<node CREATED="1700703995258" ID="ID_96569993" MODIFIED="1700704001217" TEXT="Manipulator-Function"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1700577811739" ID="ID_1356052727" MODIFIED="1700623391805" TEXT="Konfigurations-DSL aufbauen">
|
||||
|
|
@ -97414,12 +97611,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#564965" DESTINATION="ID_1812170860" ENDARROW="Default" ENDINCLINATION="-709;47;" ID="Arrow_ID_107668670" STARTARROW="None" STARTINCLINATION="-169;-5;"/>
|
||||
<arrowlink COLOR="#564965" DESTINATION="ID_1812170860" ENDARROW="Default" ENDINCLINATION="-607;44;" ID="Arrow_ID_107668670" STARTARROW="None" STARTINCLINATION="-77;0;"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1700763417779" ID="ID_1109287945" MODIFIED="1700769052796" TEXT="Policy-Template intern in TestChainLoad aufbauen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1700763442493" ID="ID_1428433327" MODIFIED="1700764071300" TEXT="Typedefinition ⟿ bezieht non-type-Template param ein">
|
||||
<node COLOR="#338800" CREATED="1700763442493" ID="ID_1428433327" MODIFIED="1700770867117" TEXT="Typedefinition ⟿ bezieht non-type-Template param ein">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
|
|
@ -97429,13 +97626,35 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700769068457" ID="ID_476049536" MODIFIED="1700769084452" TEXT="Typ für »config-rules« auf RandomDraw aufbauen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1700769068457" ID="ID_476049536" MODIFIED="1700770746672" TEXT="Typ für »config-rules« auf RandomDraw aufbauen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700240183293" ID="ID_1092101612" MODIFIED="1700240190782" TEXT="Regel-Baukasten">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#f8f1cb" COLOR="#a50125" CREATED="1700770889303" ID="ID_1475798694" MODIFIED="1700770937999" TEXT="Non-copyable Rules — problematisch für DSL">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node COLOR="#5b280f" CREATED="1700770943791" ID="ID_1199767820" MODIFIED="1700770980394" TEXT="sie müssen non-copyable sein wegen internem Function-binding">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700770992624" ID="ID_79615506" MODIFIED="1700771287660" TEXT="das verhindert aber genau den fluenden Umgang damit">
|
||||
<arrowlink COLOR="#ffcdd1" DESTINATION="ID_1702969215" ENDARROW="Default" ENDINCLINATION="-620;68;" ID="Arrow_ID_1851761641" STARTARROW="None" STARTINCLINATION="296;14;"/>
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
</node>
|
||||
<node COLOR="#5b280f" CREATED="1700771023973" FOLDED="true" ID="ID_712277297" MODIFIED="1700771154556" TEXT="Workaround: spezielle Setter schaffen">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1700771082253" ID="ID_1566020225" MODIFIED="1700771090144" TEXT="RandomDraw müßte das unterstützen"/>
|
||||
<node CREATED="1700771090804" ID="ID_370137599" MODIFIED="1700771098955" TEXT="Setter müßte unterscheiden können"/>
|
||||
<node CREATED="1700771100003" ID="ID_510680184" MODIFIED="1700771114004" TEXT="Funktionen müßten zu einer Neu-Konstruktion führen"/>
|
||||
<node COLOR="#5b280f" CREATED="1700771116536" ID="ID_401453770" MODIFIED="1700771148753" TEXT="das DSL-Verb »mapping« würde trotzdem nicht nutzbar sein">
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1700771156458" ID="ID_1157037029" MODIFIED="1700771190968" TEXT="RandomDraw re-konfigurierbar machen">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue