Commit graph

3648 commits

Author SHA1 Message Date
a3a64147c1 TreeExplorer: implementation draft for the transform-operation
attempt to re-use the same traits as much as possible

NOTE: new code not passing compiler yet, but refactored old code
      does, and still passes unit test
2017-11-30 03:52:32 +01:00
5b86b660ae TreeExplorer: draft functionality of transform-operation 2017-11-28 03:53:09 +01:00
884af619a1 Library: change IterStateWrapper to delayed start-of-evaluation
this is a subtle change which, given all interfaces were used in a logically
consistent way, should not cause any observable change to the yielded elements.
But it changes runtime behaviour, insofar now the evalutaion is initiated
lazily, when first requesting a result type. Prior to this change, the
constructor immediately issued a call to the yield() extension point,
which presumably has the side-effect of preparing the core and initiating
any embedded evaluation, in order to get at the first result; it might
even detect an empty state.

Given the fact that all access operations on the iterator front-end perform
an empty check (and possibly throw at that point), this call is redundant.
2017-11-27 05:56:03 +01:00
134821ca15 DOC: document some of the language limitations highlighted by this research 2017-11-27 05:39:47 +01:00
d8f7a22123 TreeExplorer: cover all the remaining cases supported for the expansion functor 2017-11-27 05:07:06 +01:00
86856390e1 TreeExplorer: cover expansion using a different result type
here using a lambda with side-effect and returning a reference to
a STL collection with the children, which is managed elsewhere.
2017-11-27 05:07:06 +01:00
77c3226948 TreeExplorer: identify yet another subtle type inference problem
surprising behaviour encountered while covering more cases

...obviously the return type of ExpandFunctor::operator()
was inferred as value, even while the invoked functor, from which
this type was deduced, clearly returns a reference.

Solution is simple not to rely on inference, moreover since we know
the exact type in the enclosing scope, thanks to the refactoring which
made this ExpandFunctor a nested class

NOTE:
as it turned out, this is not a compiler bug,
but works as defined by the language:
on return type inference, the detected type is decayed,
which usually helps to prevent returning a reference to a temporary
2017-11-27 05:02:57 +01:00
89005dbeb7 TreeExplorer: fix spurious copy of iterator (argument) on functor invocation
...since our iterators *always* yield a reference to the exposed element,
we can *always* get that referency into the nested yield to obtain the value
2017-11-26 22:29:51 +01:00
9e96ea8323 TreeExplorer: documentation of technicalities 2017-11-25 03:56:44 +01:00
76a11b3730 TreeExplorer: rename and refactor for readability
...while this implementation works now, it is still very complex and intricate.
I am still doubtful this is a good approach, but well, we need to try that route....
2017-11-25 03:54:41 +01:00
bb948bff34 TreeExplorer: working solution to accept generic lambda
but possible only for the iterator -> iterator case

Since we can not "probe" a generic lambda, we get only one shot:
we can try to bind it into a std::function with the assumed signature
2017-11-25 02:16:21 +01:00
4098e2024d TreeExplorer: Sketch how it might be possible to accept generic lambdas
...based on the research from yesterday
2017-11-24 23:48:56 +01:00
3614085ff7 Library: improve the function-signature detector to work as guard with enable_if
This is a consequence of the experiments with generic lambdas.
Up to now, lib::meta::_Fun<F> failed with a compilation error
when passing the decltype of such a generic lambda.

The new behaviour is to pick the empty specialisation (std::false_type) in such cases,
allowing to guard explicit specialisations when no suitable functor type
is passed
2017-11-24 23:48:56 +01:00
18553f22b2 TreeExplorer: cover both variants of functor signature by unit test (PASS) 2017-11-23 03:29:26 +01:00
c5311a116a TreeExplorer: concept how to generalise the expansion functor
Basically we want to support two distinct cases, just by slightly adapting
the invocation of the expansion functor:

Case-1: classical monadic flatMap:
        the Functor accepts a value yielded by the source iterator
        and builds a new "expaneded" iterator

Case-2: manipulation of opaque implementation state
        the Functor knows internal details of the source iterator
        and thus takes the source iterator as such as argument,
        performs some manipulation and then builds a new sub-iterator

A soulution to reconcile those two distinct cases can be built
with the help of a generic lambda
2017-11-23 03:06:02 +01:00
f10e66e4ae TreeExplorer: design a solution to handle expansion of children
this solution makes me feel somewhat queasy..
stacking several adaptors and wrappers and traits on top of each other.

Well, it type checks and passes the test, so let's trust functional programming
2017-11-20 01:03:44 +01:00
d10c5a4f77 TreeExplorer: draft the core (explore) operation
The plan is to use a monad-like scheme, but allow for a lot of leeway
with respect to the src and value types of the expand functor.
A key idea is to allow for a *different* state core than used in the source
2017-11-19 20:36:19 +01:00
cbb35d7161 TreeExplorer: add shortcut to adapt STL container automatically
...selecting the iterator or const iterator as apropriate
2017-11-19 17:35:00 +01:00
fd3d6fb60e TreeExplorer: first testcase, build either from Lumiera-Iterator or use StateCore
TODO: also wrap any suitable STL iterable.
we need a one-shot solution here
2017-11-19 02:28:48 +01:00
fe3feee67a Library: metafunction to detect support for a specific extension point
such a detector function can be used to enable some template specialisation
based on the fact that a target type exposes the desired extension point
2017-11-19 01:43:19 +01:00
9460f79039 WIP: draft how to figure out the kind of iterator
...but does not work as intended:
 * just forming an IterStateWrapper does not trigger SFINAE cleanly in all cases
 * IterStateWrapper can be formed, even when some of the extension points are missing;
   this will be uncovered only later, when actually using one of the operations

but beyond that, the basic type selection logic can work this way
2017-11-18 19:28:57 +01:00
a7bdc05091 WIP: draft first testcase
...just wrapping various kinds of iterators
2017-11-18 18:40:30 +01:00
c3b04af76f TreeExplorer: decide upon the steps towards implementation
Here, the tricky question remains, how to relate this evalutaion scheme
to the well known monadic handling of collections and iterators.

It seems, we can not yet decide upon that question, rather we should
first try to build a concrete implementation of the envisioned algorithm
and then reconsider the question later, to what extent this is "monadic"
2017-11-18 03:00:59 +01:00
782b4f949f TreeExplorer: extended analysis regarding tree expanding and backtracking computation (#1117)
This can be seen as a side track, but the hope is
by relying on some kind of monadic evaluation pattern, we'll be
able to to reconcile the IterExplorer draft from 2012 with the requirement
to keep the implementation of "tree position" entirely opaque.

The latter is mandatory in the use case here, since we must not intermingle
the algorithm to resolve UI-coordinates in any way with the code actually
navigating and accessing GTK widgets. Thus, we're forced to build some kind
of abstraction barrier, and this turns out to be surprisingly difficult.
2017-11-17 21:43:50 +01:00
ca35891c41 Navigator: implement the mutation operations defined thus far
...so the only thing not yet implemented is the actual path resolution algorithm
2017-10-30 03:10:51 +01:00
e035dbc54a UI-Coordinates: support for truncating a given spec
...implemented within the builder.
Will shorten and discard extraneous storage,
but not expand and allocate new one
2017-10-30 02:59:56 +01:00
5530bbede8 Navigator: decide upon the fine points of meaning
anchorage vs. coverage
partial vs total
possible anchorage
possible coverage
2017-10-30 01:47:29 +01:00
4b6b4ad708 LocationQuery: now able to handle perspective info properly
...which was deliberately represented in an asymmetric way, to verify the
design's ability to cope with such implementation intricacies. So basically
we have to kick in at LEVEL == 1 and access the implementation differently.

This exercise just shows again, that treating tree structures recursively
is the way to go, and we should do similar when coding up the query-API
for the real GTK toolkit based window elements...
2017-10-29 16:00:08 +01:00
750b124f88 Library: complement the pseudo-iterator by a IterSource front-end 2017-10-29 15:31:34 +01:00
0682e449a3 Library: a pseudo-iterator to yield just a single value
...which can be helpful when a function usually returns a somewhat dressed-up iterator,
but needs to return a specific fixed value under some circumstances
2017-10-29 14:51:51 +01:00
7e241d9a11 Library: a little bit of modernising and overhaul
- fix some warnings due to uninitialised members
  (no real problem, since these members get assigned anyway)
- use a lambda as example function right in the test
- use move initialisation and the new util::join
2017-10-29 13:22:25 +01:00
f0a32c986a LocationQuery: fix bugs and omissions 2017-10-28 02:06:05 +02:00
800407637a LocationQuery: compensate for the special representation of perspective info
this assymetry in representation was introduced deliberately,
to test the design's ability to cope with such complications
2017-10-28 01:12:06 +02:00
c39442a287 LocationQuery: recast syntax for inline structure definitions
this fixes a silly mistake:
obviously we want named sub-nodes, aka. "Attributes",
but we used the anonymous sub-nodes instead, aka. "Children"

Incidentally, this renders the definitions also way more readable;
in fact the strange post-fix naming notation of the original version
was a clear indication of using the system backwards....
2017-10-28 00:17:56 +02:00
16abe82cde LocationQuery: fix a segfault due to ill guided conversion path 2017-10-27 05:12:28 +02:00
1406aa5532 Library: allow Initialisiation of a GenNode from a Rec::Mutator
up to now, we allowed only initialisation with a precisely matching type.
But this special case seems worth supporting, since it typically occurs
within the "object builder" syntax based on Rec::Mutator
2017-10-24 03:51:06 +02:00
198dcc622a Bugfix Library: forward initialiser properly into GenNode
...to avoid unnecessary copy.
Especially relevant for initialising a sub-Record from the object builder syntay "MakeRec()"
2017-10-24 02:44:47 +02:00
5f9b8eb18c LocationQuery: draft the other query functions as recursive drill-down
Note: Unit test still fails...
2017-10-23 04:13:38 +02:00
75a7ecb6b3 LocationQuery: draft simple coverage check
ugly while loop....
maybe recursive?
2017-10-23 04:12:31 +02:00
144cc97e1b LocationQuery: draft simple coverage check
ugly while loop....
maybe recursive?
2017-10-23 03:17:18 +02:00
240459c550 LocationQuery: implement simple resolution of explicit anchoring by window-ID 2017-10-23 02:16:57 +02:00
fd3777de54 Navigator: draft the trivial resolution case
...based on the abstract LocationQuery interface
2017-10-21 23:47:27 +02:00
78a9ae875b Navigator: initial draft of the LocationQuery interface
the intention is to rely solely upon this abstract interface
in order to navigate the structure of the actual UI, so the
resolution process remains decoupled from the technicalities
of the actual UI toolkit set.

Through implementation of the corresponding unit test we'll determine
what it actually takes to build such a path resolution algorithm...
2017-10-21 23:37:04 +02:00
0dd516a298 Navigator: consider how to approach path resolution
obviously, we get a trivial case, when the path is explicit,
and we need a tricky full blown resolution with backtracking
when forced to interpolate wildcards to cover a given UICoord
spec against the actual UI topology.

Do we need it?
 * actually not right now
 * but already a complete implementation of the ViewSpec concept
   requires such a resolution
2017-10-21 01:53:13 +02:00
2d5717bfd7 Navigator: continue draft of UI coordinate resolver 2017-10-18 03:40:26 +02:00
7b2c98474f Navigator: initial draft of a UI coordinate resolver
...which in turn will drive the design of the LoactionQuery API
2017-10-16 02:39:22 +02:00
25c4e6b506 UI:Coordinates: Fix indentation 2017-10-13 21:41:13 +02:00
ed76151d14 UI-Coordinates: value representation finished and unit test PASS (#1106) 2017-10-03 00:57:23 +02:00
f23b02b841 UI-Coordinates: implement simple locally decideable predicates 2017-10-02 23:41:03 +02:00
d9555701ac UI-Coordinates: implement a partial "sub path" order 2017-10-02 23:06:23 +02:00