Re: Declaring a Function Before it is used
- Posted by "Christian Cuvier" <Christian.CUVIER at agriculture.gouv.fr> Oct 31, 2003
- 390 views
Hi the list! I'm sorry to disagree with you, Rob, because I can read source files only from start to end of file (and expect a plurality of people to do so :) ). Assume routineA() calls subroutineA1(), subroutineA2() and sunbroutineA3(). In the current layout enforced by Euphoria, I have to read through the code of all three suroutines (hopefully they don't call anything else to be stacked berofre them) before understanding (at last!) why they are here in the first place, what the arguments mean etc, as the answer appear inside the code of routineA(). As a result, the general layout of the code is made positively more obscure by disallowing forward referenceing, not clearer. Regards CChris > Date: Thu, 30 Oct 2003 13:51:40 -0500 > From: Robert Craig <rds at RapidEuphoria.com> > Subject: Re: Declaring a Function Before it is used > > > Irv Mullins wrote: > >>> I understand the desirability of declaring a routine before referencing >>> it. But why couldn't something like: >>> >>> declare function foo(2) >>> or >>> declare function foo ( name, age ) >>> >>> be used to declare a routine in advance? Seems that meets the >>> philosophical requirements as well as the practical ones. > > > In practice, people would simply arrange their > routines in random order, then keep adding > declarations until the interpreter shuts up. > > I like having some kind of logical order imposed, > and machine verified. You may have an even more > logical way of arranging some of your routines, > but what does it mean to me as the reader of your > code? And is it machine verified? > > I still think the advantages of > "define-it-before-you-use-it" outweigh > the nuisance of occasionally having to copy/paste > a routine to a new place. It may not be desirable > in *every* program, but when people know there are > no exceptions to this rule, it promotes the > readability and maintainability of Euphoria > programs in general. > > Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > >