Hi Mark,
I'm basing my remarks on
https://github.com/hyphz/fr8x-editor/tree/257e244c3a20175a5c88d8c2f776999897025776

Like you said, for the <arrow> to work, it needs to be activated. In your
program the activation of the arrow is done by the "open-window" which
calls the graft method of the <checkbox> holding your <partmodel>. So I
guess you should move your code around to not depend on the data of the
arrow until all the models have been activated. Maybe you can just remove
the call to partmodel-fetch in new-partmodel, are they really needed ? The
ui starts fines without them.

Hope that helps,
Jon



Jon

On Fri, Jan 2, 2015 at 1:08 AM, Mark Green <m...@antelope.nildram.co.uk>
wrote:

> Hi folks,
>
> After my previous post about a model which could extract a part of a
> complex structure inside another model, I had a go at it myself as follows:
>
> TUPLE: partmodel < model master extractor updater ;
>
> : partmodel-fetch ( partmodel -- )
>     dup [ master>> value>> ] [ extractor>> ] bi call( master -- part )
> swap set-model ;
>
> : new-partmodel ( master extractor updater class -- partmodel )
>     f swap new-model swap >>updater swap >>extractor [ add-dependency ] [
> swap >>master ] 2bi dup partmodel-fetch ;
>
> M: partmodel model-changed
>     nip partmodel-fetch ;
>
> M: partmodel update-model
>     dup master>> locked?>> [ "Warning: partmodel failing to update master"
> . drop ] [
>         dup [ master>> value>> ] [ value>> ] [ updater>> ] tri call(
> mastervalue newslavevalue -- )
>         master>> [ [ update-model ] [ notify-connections ] bi ]
> with-locked-model
>     ] if ;
>
> : <partmodel> ( master extractor updater -- partmodel ) partmodel
> new-partmodel ;
>
> : <nthmodel> ( master index -- partmodel )
>     [ '[ _ swap nth ] ] [ '[ _ rot set-nth ] ] bi <partmodel> ;
>
>
> Notice that I ended up having to roll my own notification inside
> update-model because using set-model doesn't seem appropriate given that
> the reference to the higher level structure will not change and most of the
> functions for updating parts of complex structures act in place and pop the
> old reference form the stack.
>
> The problem however occurs when I create a <partmodel> whose master is an
> <arrow>. In this case, even when I add it to a UI element, the <arrow> does
> not seem to be activated and does not fetch its value. This seems odd as
> the partmodel should have the arrow added to its dependency list in
> new-partmodel before being activated itself. Am I doing something terribly
> wrong?
>
> Mark
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to