On Jun 15, 2011, at 13:12 , Jon Harper wrote:

> On Wed, Jun 15, 2011 at 6:42 PM, Joe Groff <arc...@gmail.com> wrote:
>> 
>> With a bit of boilerplate, you can set up a namespace with "bind" and
>> capture the namespace into your callback quotation:
>>  …
> I think the whole point was to avoid modifying the callbacks because
> there are many in a typical GUI app.. Else he could have specified the
> "with-logging" in all the callbacks.

Indeed.  I'd like to wrap my UI startup in:
[ … ] with-<whatever>

and have it do what I expect with regard to the variables when the GUI's 
running.

I just tried some tricks to get with-logging to set a global variable, but it 
calls bind and so sets the variable in a new namespace at the top of the 
namestack.

> Also, did you actually try the global variables ? The global namespace
> is created at image creation, and the variable (through get) is
> searched hierarchically in all parent namespaces until it a value is
> found. So if the variable doesn't have a value in the local
> namespaces, it will correctly use the one from the global namespace.
> At least from what I understand, I might be mistaken.
Hmm, you're right, globals *do* work.  I tried it the other day and had no 
luck; I must have done something wrong.

So, I can work around this by storing a namespace/assoc in a global (or 
stashing it in a slot on my world) and then iterating through those in 
begin-world, setting each variable.  It doesn't look like a good idea to modify 
the namestack directly, or I'd take that approach.

I've gotta say that it's really interesting and fun working with a language 
where namespaces and variable bindings are an optional feature. :-)

best,
- Fred.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to