Nested Calls
Fairlight
fairlite at fairlite.com
Wed May 2 16:27:01 PDT 2018
On Wed, May 02, 2018 at 07:06:49PM -0400, Jose Lerebours via Filepro-list thus spoke:
>
> Again, I can see calling one or two tables but the use of "nested"
> and wonder about how deep you can go gives me pause and wonder why
> one would need more than two or three ... I have written very large
> and very complex filePro application and never needed more than one,
> perhaps because I adopted to the handicap back then.
Let's say you have a routine which deals with latitude and longitude
conversion. You make a prc.latlonconv to do your conversion tasks.
Now let's say you have always needed this from input processing. That's
fine.
One day, you write a new routine which is called from input. Let's say
it's prc.newtask. Unfortunately for you, you need "newtask" to actually do
some "latlonconv" work. So simply CALL it from inside "newtask". Oh
-wait-! You can't! Why? Because you've already CALLed "newtask" from
input, so you're one level deep already. Prior to 5.6, that one level deep
is all you got.
To do what you need to do, you need...wait for it... NESTED CALLS.
As we have said already, nested calls let you use one universal chunk of
code -from anywhere-. This means from zero levels deep, or 20 levels deep.
Doesn't matter, it just works.
If you have trouble wrapping your mind around the lat/lon example (just
something I pulled out of thin air), imagine something more practical like
a custom logging routine. You have a routine which will append a log
line to a centralised file, which also maintains the file as a rolling
ring buffer, so your disk doesn't fill up. All you need to do is set a
variable and call your routine, and it handles the hard work of logging
-and- keeping your size constraint constant. You -could- use it to debug
your code product-wide with one unified interface, if you have nested
calls. Without those, you can't do that without replicating the majority
of the logging code in every table where you want to use it. Not exactly
plug-and-play modular, in that case.
mark->
--
Audio panton, cogito singularis.
More information about the Filepro-list
mailing list