On Wed, Jun 15, 2011 at 6:42 PM, Joe Groff <arc...@gmail.com> wrote: > > On Jun 14, 2011, at 1:14 PM, Fred Alger wrote: > > I'm fine with putting this kind of setup into `begin-world` for now. > I'm just wondering if there's a better way to handle this, as it'd > handy to be able to set a bunch of variables before handing things off > to the GUI. > > With a bit of boilerplate, you can set up a namespace with "bind" and > capture the namespace into your callback quotation: > H{ } clone :> ns > ! initialize variables > ns [ > 1 "foo" set > 2 "bar" set > ] bind > ! set up the same namespace in the callback > [ ns [ ... ] bind ] register-other-thread-callback > or without locals: > H{ } clone > [ [ 1 "foo" set ... ] bind ] > [ '[ _ [ ... ] bind ] register-other-thread-callback ] bi > -Joe
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. 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. Jon ------------------------------------------------------------------------------ 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