|Re: HP39GII and local functions|
Message #13 Posted by Tim Wessman on 24 July 2012, 1:10 p.m.,
in response to message #12 by Gilles Carpentier
There are a few interesting things here.
On first run, the terminal would have:
The next time you run however, the first printed item will be "b". You can have variables that stay around by declaring them outside a program scope. Every function or routine in that program file will be able to use b as a variable. Other programs will not. I believe the content of b also stays around when you power cycle.
So the EXPORT keyword turns it into something recognized anywhere in the system, a non-exported variable outside of a scope will be available to anything in the program file (the file itself is the scope), and something inside of a function is limited to that specific function.
As for type...yeah, oops. We kind of forgot to include that. :-(
Nice thing is it only takes a short time to code it (probably an hour or so for something this simple) and it is fully integrated into the system. To define a system function/variable you provide: a name, getter/evaluator, setter (if a variable), min args, max args, algebraic priority, enabling of automatic input processing including list processing for specific agrumnts, whether it requires full qualification (C1 versus Statistics_2Var.C1 - eg. global or not), special printing if needed, Help, Menu id, and special printing for 2d mode (sigma or the like).
Then you have a new function that will work properly everywhere - including the help interface, placement in the appropriate menu location and even will handle special printing in 2d display mode!
Contrast that with adding a built in function to the 50g ROM. Might take anywhere from a week to much more depending on quite a few factors.
Edited: 24 July 2012, 1:37 p.m.