Henry Rich wrote:
> Verb definitions that lack trailing ) are the thing that causes
> me the most trouble teaching beginners.  When they execute the
> erroneous verb, nothing seems to happen (because it's waiting for
> the ) to be entered from the console) and they say 'Roger has died'.
> 
> I have just realized that I can do something about this.  I am
> going to redefine the script_z_ verb for my students so that it
> checks for missing ) in scripts before they are loaded.  The changed
> script_z_, which will go into their profile, is given below.
> 
> 0. Can anyone think of anything else that should go into a
> beginner-protection script?  (I don't claim that this change
> should go into the system)
> 
> 1.  Can anyone explain why the script_z_ verb goes to the trouble of
> erasing y before loading the script?  Do I need to erase all
> the temporary variables I create?

script_z_ erases y in case the script assigns y globally - this would
conflict with the local assignment of y. The same would be true of any
local assignment you create.

The problem with fixing script to avoid script errors is that they are
then hidden from the user. I would be more inclined to add this kind of
checking to Format Script (Ctrl+L) (right now, it has no such check).

I don't see the problem with a lack of trailing ). If you load a script
whose last definition has a missing trailing ), the definition seems to
be created correctly.


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to