You can call set-global and get-global instead of set and get. The words
are executing in the dynamic scope of the parser and the values getting
lost when parsing returns.

Doug

On Tue, Dec 16, 2014 at 8:55 AM, Andrea Ferretti <ferrettiand...@gmail.com>
wrote:
>
> Hi, I am trying to define some syntax words that should have effect on
> a global (or dynamic) variable. What I am trying to achieve is
> something similar to how the LIBRARY: word affects later occurrences
> of FUNCTION:
>
> The problem is, it does not seem to work. The simplest example I can
> make is up the following.
>
> In package foo
>
>     USING: kernel lexer namespaces ;
>     IN: foo
>
>     SYMBOL: foo
>
>     SYNTAX: FOO: scan-token foo set ;
>
> Then in package bar
>
>     USING: namespaces foo prettyprint ;
>     IN: bar
>
>     FOO: hello
>
>     foo get .
>
>
> This executes the top level form `foo get .` but prints f instead of
> "hello". The same happens if I use run-file directly. If, instead, I
> make the same declaration
>
>     FOO: hello
>
> in the listener, I can check that foo is modified.
>
> Is there a way to make this work? I could also avoi the variable, but
> while parsing I do not have access to the stack, and so I do not know
> how to pass any information among parsing words.
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to