You can't do that
Jay R. Ashworth
jra at baylink.com
Wed Aug 31 07:48:59 PDT 2005
On Wed, Aug 31, 2005 at 07:31:03AM -0400, John Esak wrote:
> > > > Here are some other "would be nicest":
> > > >
> > > > Functions and arguments would be nice. I would like to pass
> > > > arguments to a particular call (or chain) and have it return a
> > > > value.
> > >
> > > Now hold on... am I missing something. This is pretty much
> > > *exactly* what I use CALL tables for in the first place. What do
> > > you mean???
> >
> > Ok, to clarify here, I would like to do something like the
> > following:
> >
> > returnvariable = call("mycode",arg1,arg2)
> >
> > Does this make sense? This way I could pass arg1 and arg2 into the
> > call table without worrying having to keep track of which variables
> > should be used in which tables and which ones should be defined as
> > global, or external, etc. You could set aside new system maintained
> > fields like @p1, @p2, etc to refer to the parameters within the
> > "mycode" table.
>
> > Also, within "mycode", you could have a return (returnvalue)
> > statement that would return a value to the calling table and
> > populate the returnvariable above.
>
> Okay, I'm glad you clarified this. Now, I'm sure I disagree with you
> on this. That construct would be severely limiting to what is now a
> completely open situation that can do anything.
Yep, it can do anything.
The code inside your called function, due to an almost-unfindable typo,
can completely trash your mainline because the mainline's variable
namespace is not protected by scoping rules from the variables inside
the called function.
Structured Programming 101.
Yes, it occasionally makes some useful, powerful constructs harder to
implement... but the amount of debugging time it saves you in the
mainstream is almost incalculable.
Cheers,
-- jra
--
Jay R. Ashworth jra at baylink.com
Designer Baylink RFC 2100
Ashworth & Associates The Things I Think '87 e24
St Petersburg FL USA http://baylink.pitas.com +1 727 647 1274
"NPR has a lot in common with Nascar... we both turn to the left."
- Peter Sagal, on Wait Wait, Don't Tell Me!
More information about the Filepro-list
mailing list