FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » error message I don understand
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Nasty language semantics (Was: error message I don understand) [message #174921 is a reply to message #174917] Mon, 18 July 2011 08:22 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article <ivvorv$19k$1(at)dont-email(dot)me>,
August Karlstrom <fusionfile(at)gmail(dot)com> wrote:

> On 2011-07-18 00:06, Tim Streater wrote:
>> Also at the time academics were pushing the
>> single-entry-single-exit bullshit, so there was no return statement.
>
> I guess a certain level of maturity is required to appreciate some of
> these "restrictions". The return statement goes against the idea of a
> truly structured goto-less programming language. Wirth introduced the
> return statement (tried it) in Modula-2 and in the first versions of
> Oberon but replaced it with a return clause (single exit point) in
> Oberon-07. Here is a quote by Niklaus Wirth from "Differences between
> Oberon-07 and Oberon"*:
>
> "The result of a function procedure was specified by a return statement.
> This form has the unpleasant property that the return statement is
> syntactically disconnected from the function procedure declaration,
> similar to the exit from the loop statements. It is therefore difficult
> to check, whether or not a function procedure declaration specifies a
> result, or perhaps even several of them. Now the result specification
> becomes syntactically a part of the procedure declaration, and vanishes
> as an independent statement form."

Mmm, and code becomes unreadable as a result, with lots of extra if-else
nesting to try to ensure that from a given point where I would do a
return, no more code is going to be executed in the function. Unreadable
because I have to spend a long time convincing myself that no more code
will, in fact, be executed.

I haven't used a goto since 1978 when I gave up writing FORTRAN. Oh
wait, tell a lie, there was a period when I had to, since I was obliged
to write in Pascal and there was no return statement. So I faked one by
labelling the end of the function with 999: and then doing goto 999.

Thank God that piece of impractical nonsense has gone the way of the
Dodo. Early return simplifies code; I regard it as my responsibility to
ensure I return the right thing.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Ouion Movement, Roun Time (Floating Point Time)
Next Topic: [MEMCACHED] Is there a way to get the expiration of a key?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 08:51:26 GMT 2024

Total time taken to generate the page: 0.04419 seconds