RE: Declaring a Function Before it is used

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

I'm trying to see both sides of the argument. While I think that having the
possibility of forward references may ease program writing, I'd like to talk
about two experiences I'm having.
At the moment, I'm not programming in Euphoria but in C, and I'm teaching C
at a  University here in Buenos Aires.
1) I wrote two very large programs in C. Each one is contained in a *single*
file. I did not use prototypes at all. I do not have mutually recursive
routines in them, nor simply recursive ones, for that matter. So, I had to
arrange routines in their usage order, and I feel this helped me to better
organize and follow my programs.
2) I've found that one of the main problems that face beginner C programmers
is in using prototypes. As far as 30% or 40% of the errors I find in their
programs are due to inconsistencies between prototypes and actual function
definitions. So, I teach them to order functions in the souce file the same
way we have to do in Euphoria, unless they have mutually recursive functions
(which at the beginner level are seldom used).

As a conclusion, in a way I am with Rob in this subject, though I admit that
in certain cases forward referencing will alleviate program writing.

Regards.
----- Original Message -----
From: Pete Lomax <petelomax at blueyonder.co.uk>
To: <EUforum at topica.com>
Sent: Thursday, October 30, 2003 9:31 PM
Subject: Re: Declaring a Function Before it is used


>
>
> On Thu, 30 Oct 2003 13:51:40 -0500, Robert Craig
> <rds at RapidEuphoria.com> wrote:
>
> >In practice, people would simply arrange their
> >routines in random order, then keep adding
> >declarations until the interpreter shuts up.
>
> And if they had no need to add the declarations in the first place?
>
> You are actually admitting here, that this is a problem, and the
> second word of your answer is "off", the first being too rude to print
>
> >
> >I still think the advantages of
> >"define-it-before-you-use-it" outweigh
> >the nuisance of occasionally having to copy/paste
>
> OCCASIONALLY?!!!!
>
> Stop thinking about trivial programs.
>
> >a routine to a new place. It may not be desirable
> >in *every* program,
>
> This happens in EVERY program over a few thousand lines.
>
> >but when people know there are
> >no exceptions to this rule,
>
> If you are adamant on that, allow "forward func/proc xxx(whatever)".
> Personally, I believe you don't _have_ to do it that way, but as Irv
> said, it that's your philosophical requirement, so be it.
>
> What you have now does not make people happy.
>
> >it promotes the
> >readability and maintainability of Euphoria
> >programs in general.
>
> Don't believe you could show even one case where that last statement
> is true.
>
>
> Pete
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu