Hi,
About the parsing using append! as below
> SYNTAX: FOO: scan-token '[ _ foo set ] append! ;
seemed to have the same effect as this one, which is more understandable
SYNTAX: FOO1: scan-token '[ _ foo set ] suffix! \ call suffix! ;
As I knew, append! has the stack effect of ( seq seq -- seq ) but the
quotation is not a kind of seq, how this works?
BR
kuo
於 2014/12/17 上午1:00, John Benediktsson 提到:
> If you want your code to work the way you intend, using a local
> namespace, then how about this:
>
> SYNTAX: FOO: scan-token '[ _ foo set ] append! ;
>
> That will set in the namespace that you want.
>
> On Tue, Dec 16, 2014 at 8:59 AM, John Benediktsson <mrj...@gmail.com
> <mailto:mrj...@gmail.com>> wrote:
>
> Also, I'm not sure why you need a parsing word for that, you can
> just:
>
> IN: foo
>
> SYMBOL: foo
>
> IN: bar
>
> foo [ "hello" ] initialize
>
> ... or
>
> "hello" foo set-global
>
> the first will initialize if not ``f``, the second will always set.
>
>
>
> On Tue, Dec 16, 2014 at 8:55 AM, Andrea Ferretti
> <ferrettiand...@gmail.com <mailto: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
> <mailto: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
------------------------------------------------------------------------------
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