Slashdot Mirror


Developer Argues For 'Forgotten Code Constructs' Like GOTO and Eval (techbeacon.com)

mikeatTB quotes TechBeacon: Some things in the programming world are so easy to misuse that most people prefer to never use them at all. These are the programming equivalent of a flamethrower... [But] creative use of features such as goto, multiple inheritance, eval, and recursion may be just the right solution for experienced developers when used in the right situation. Is it time to resurrect these four forgotten code constructs?
The article notes that the Linux kernel uses goto statements, and links to Linus Torvalds' defense of them. ("Any if-statement is a goto. As are all structured loops...") And it points out that eval statements are supported by JavaScript, Python, PHP, and Ruby. But when the article describes recursion as "more forgotten than forbidden," it begs the inevitable question. Are you using these "forgotten code constructs" -- and should you be?

4 of 600 comments (clear)

  1. Re:Doing it wrong? by quenda · · Score: 5, Funny

    Honest question: Am I not supposed to use recursion?

    It depends. See https://developers.slashdot.or...

  2. Re: Doing it wrong? by Z00L00K · · Score: 4, Funny

    Whenever recursing, have a recursion counter and a termination condition that stops infinite recursions.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  3. Re:Doing it wrong? by ShanghaiBill · · Score: 3, Funny

    In the book "C Traps and Pitfalls", on page 146 of the index it says "recursion 88, 146".
    The index also contains “pitfalls, see traps” and “traps, see pitfalls.”

  4. Re: Doing it wrong? by Darinbob · · Score: 4, Funny

    There are people who think such things are beyond the ken of mortal man. Mere programmers should use libraries and only the gods themselves write the libraries.