[Factor-talk] Namespaces and the UI

2011-06-14 Thread Fred Alger
Hey gang,

I'm trying to get logging to work from my GUI application.  I tried
the obvious, which is:

dystopian [ … open-window ] with-logging

However, it seems that the UI window and gadgets all run in a new
dynamic scope, and so the `logging-service` variable is unset and all
logging calls silently fail.  I worked around it for now by
subclassing `world`:

TUPLE: dystopian-world  world ;

M: dystopian-world begin-world ( world -- )
drop dystopian log-service set ;


However, this is the second time I've gotten bitten by this namespace
issue, and it's really tricky to debug.  I've been up and down and
around the ui and the ui.backend vocabs, and I can't find any place
that either creates a new thread or calls `init-namespaces` directly.
And yet, every time, my UI code runs in a new namespace.

Is this a UI backend implementation detail?  Why (and where) does this
new namespace and/or thread get created?


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


Re: [Factor-talk] db.tuples and boolean types

2011-06-14 Thread Fred Alger
 How do you select-tuples from a db with a slot set to f? The help says
 that A SQL query is constructed from the slots of the exemplar tuple
 that are not f. So for example the following won't work:

 [ T{ book { sold f } } select-tuples ] with-books-db

 Do you have to use two slots, sold and unsold, and select T{ book {
 unsold t } }? Is there some other way that still lets you use
 select-tuples?

I haven't tried this, but you might try passing a value that will get
converted to FALSE at the database level, for example:
[ T{ book { sold 0 } } select-tuples ] with-books-db

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


Re: [Factor-talk] Namespaces and the UI

2011-06-14 Thread Jon Harper
 Is this a UI backend implementation detail?  Why (and where) does this
 new namespace and/or thread get created?

I would guess that it's the start-ui-thread word from ui.private ?

Regarding your namespace problem, is it ok to use global variables ?

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


Re: [Factor-talk] db.tuples and boolean types

2011-06-14 Thread Tadhg O'Meara
I tried this and it seems that 0 is treated as t. I guess because 0 is
not f. I think I might have to use an INTEGER instead of a BOOLEAN
type and that way I can select for 0 and 1.

Thanks.


On 14 June 2011 16:15, Fred Alger f...@fredalger.net wrote:
 I haven't tried this, but you might try passing a value that will get
 converted to FALSE at the database level, for example:
 [ T{ book { sold 0 } } select-tuples ] with-books-db


--
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


Re: [Factor-talk] Namespaces and the UI

2011-06-14 Thread Fred Alger
On Tue, Jun 14, 2011 at 11:52 AM, Jon Harper jon.harpe...@gmail.com wrote:
 Is this a UI backend implementation detail?  Why (and where) does this
 new namespace and/or thread get created?

 I would guess that it's the start-ui-thread word from ui.private ?
Aha, cool, I didn't find that.  So when I open a window from the
listener, any quots, such as button actions, will run in that
namespace.  I suppose that in a deployed application I could wrap the
`[ ] with-ui` call with a call to `with-logging`, but I can't do that
from the listener.

 Regarding your namespace problem, is it ok to use global variables ?
Actually, no, because while these get set at the bottom of the
listener's namestack, the UI thread starts up (or has already started)
with an empty namestack and will never see the global variables.
Same problem, different scope.

Hmm, so wait, that means that the graphical listener runs in a
different thread than the UI… yep, a quick check of `threads.`
confirms that.

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.

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