Nested Gosubs

Fairlight fairlite at fairlite.com
Mon Nov 1 20:24:31 PST 2004


Yo, homey, in case you don' be listenin', John Esak done said:
> 
> The following code will give Too Many Nested GOSUB's
> after 64 iterations...  It also shows where code will not be executed... if
> one were ever to write such bad code.  The point is, that breaking out of a
> GOSUB routine from within any @wlf/ef processing is a _very_ bad idea. Even
> it it seems to work because other factors allow it to do so... eventually,
> you are going to hit the error.

Perhaps it's just me, but...unless you're calling code that's already
modular and broken out for some reason, and are RETURNing to -within- the
@when block right away, it's silly to GOSUB just for the heck of it.
While they're not strictly defined as such, mentally I perceive @when
processing as already being a subroutine in and of itself.

Maybe I just share the same aversion to spaghetti code that you do, John.
Well, definitely--but I could also be viewing @when processing differently. 
Unless it's -really- something modular, I'd almost rather just replicate
the lines in the actual @when block itself, even at the cost of extra lines
taken.  It may seem silly to duplicate code, but in larger tables the
clarity may actually be worth it--at least for me it would be.

I do think you're right about what constitutes bad programming practice in
what you cited earlier.

mark->
-- 
Bring the web-enabling power of OneGate to -your- filePro applications today!

Try the live filePro-based, OneGate-enabled demo at the following URL:
               http://www2.onnik.com/~fairlite/flfssindex.html


More information about the Filepro-list mailing list