Re: Declaring a Function Before it is used

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Thursday 30 October 2003 01:51 pm, you wrote:
>
> Irv Mullins wrote:
> > I understand the desirability of declaring a routine before referencing
> > it. But why couldn't something like:
> >
> >  d> 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.comeclare 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.

And who would be to blame for that?

> 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?

If I can arrange it more logically, that should mean to you, 
as a reader of my code, that things would appear in a more logical 
order, no?

And, just exactly what do you mean when you say "machine 
verified"?

If I declare a function: foo ( integer x )
and then call it as foo("Hello"), there is NO machine verification 
until the code runs. None, in fact, until conditions happen to be
right for a call to foo() to be executed.  
This is a source of many problems.

How could a forward declaration cause even less verification than 
what already (doesn't) exist?

Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu