[Factor-talk] CSV Library

2008-08-05 Thread Phil Dawes
Hi Slava, I finally got round to modifing csv to use a global default as per your post, sorry for the delay! I also removed the dependency on vars, although I ended up defining delimiter> as a word since it was prettier in case statements e.g. { { CHAR: " [ drop drop quoted-field ] } ! "

Re: [Factor-talk] CSV library

2008-07-30 Thread Eduardo Cavazos
On Wednesday 30 July 2008 05:18:13 Phil Dawes wrote: > Cool thanks. Just so I'm sure, does each thread have it's own complete > namestack? E.g. so thread 'b' can't override thread 'a's delimiter at > the root namespace halfway through a csv import? 'b' can override 'a's delimiter *if* it uses 'se

Re: [Factor-talk] CSV library

2008-07-30 Thread Daniel Ehrenberg
Well, threads have their own namestack, but they share the global namespace. You can write code using only set-global and get-global where threads wouldn't interact well, but if you use with-scope around code that modifies variables, there should be no need to worry about interaction between thread

Re: [Factor-talk] CSV library

2008-07-30 Thread Phil Dawes
Eduardo Cavazos wrote: > > Eh, so just to be clear, you should be able to stick this in your vocabulary > (at the top level): > > CHAR: , delimiter set-global > > and everything will work fine. You'll be able to remove the 'init-vars' word > and all calls to it. Folks will still be abl

[Factor-talk] CSV library

2008-07-29 Thread Eduardo Cavazos
Phil Dawes wrote: > > Having just read this again, I'd be inclined to use a local namespaced > > variable rather than a global one just because it might be used across > > threads. If that's the case, doesn't VAR:s boil down to the same thing? Ed wrote: > There's no distinction between "global"

Re: [Factor-talk] CSV library

2008-07-29 Thread Slava Pestov
Phil, The global variable will just provide a default value. SYMBOL: x 5 x set-global x get . => 5 10 x [ x get . ] with-variable => 10 Slava On Tue, Jul 29, 2008 at 4:42 PM, Phil Dawes <[EMAIL PROTECTED]> wrote: > Having just read this again, I'd be inclined to use a local namespaced > vari

Re: [Factor-talk] CSV library

2008-07-29 Thread Eduardo Cavazos
Phil Dawes wrote: > Having just read this again, I'd be inclined to use a local namespaced > variable rather than a global one just because it might be used across > threads. If that's the case, doesn't VAR:s boil down to the same thing? Hi Phil, There's no distinction between "global" and "loca

Re: [Factor-talk] CSV library

2008-07-29 Thread Phil Dawes
Having just read this again, I'd be inclined to use a local namespaced variable rather than a global one just because it might be used across threads. If that's the case, doesn't VAR:s boil down to the same thing? Cheers, Phil Phil Dawes wrote: > Sweet - thanks for the tips (this'll be useful el

Re: [Factor-talk] CSV library

2008-07-29 Thread Slava Pestov
On Tue, Jul 29, 2008 at 4:40 AM, Phil Dawes <[EMAIL PROTECTED]> wrote: > Sweet - thanks for the tips (this'll be useful elsewhere in my coding > too). Shall I make the changes or have you done this already in your > local copy? You can make the changes if you want. Slava

Re: [Factor-talk] CSV library

2008-07-29 Thread Phil Dawes
Sweet - thanks for the tips (this'll be useful elsewhere in my coding too). Shall I make the changes or have you done this already in your local copy? -Phil Slava Pestov wrote: > Hi Phil, > > I noticed that in several places in extra/csv, you call init-vars, > which sets the delimiter variable

[Factor-talk] CSV library

2008-07-29 Thread Slava Pestov
Hi Phil, I noticed that in several places in extra/csv, you call init-vars, which sets the delimiter variable if it isn't set already. A better solution is to use normal variables instead of VAR:s, and set the default value globally in a top-level form of the source file: CHAR: , delimiter set-gl