mar, 29 Dec 2009, Alexander Mikhailov skribis:
> 
> > it sounds like you've re-discovered why global variables are bad practice
> 
> Yes, I know that. The reason I've used them is, of course, they seemed to be 
> more convenient than alternatives.
> 
> I'm writing a parser generator. From the input grammar, which is a string, I 
> create some tables - nonterminals, rules... Then I build some functions, 
> which essentially lookups in yet other tables, calculated along the way. The 
> parser driver maintains some other tables. It's certainly possible to pass 
> them all around, just not very convenient.
> 
> I've done some restructuring already, and don't see immediately how to 
> further simplify structures - without performance penalties, which 
> (prematurely) weren't hailed much by, IIRC, Knuth.
> 
> > What I usually do in a situation like that is put smoutput around line
> > 5 If I can run it with the session manager open then you can display
> > contents and some info like $ etc for everything you want.
> 
> Thanks for tips. I'm not sure I know what J session manager is; I'm just 
> developing with J console and an *.ijs windows open.
> 

Just add smoutput to print out your debugging info, eg

smoutput 'line 5: y';y

this should also work for j console.

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to