Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Paid for crap

by demerphq (Chancellor)
on Jan 25, 2007 at 10:19 UTC ( #596443=note: print w/replies, xml ) Need Help??


in reply to Paid for crap

The gotos and lack of return statements and in fact the general coding style strongly suggest to me that it was transliterated from (bad) VB, by a not very experienced VB or Perl programmer. (I might have said Pascal but using gotos is not Pascal)

The whole assign to $_[0] as a return is strongly reminiscent of the VB concept of assigning to the function name for setting a functions return value, likewise VB (pre dotNet anyway) doesnt have a return statement, and normally relies on goto on err type logic for exception handling. Both routines have all of these characteristics.

BTW, many of these issues are older design concepts that have long since been rejected as being generally bad ideas. Using the function name as a pseudo variable makes recursive calls a bit tricky to deal with, and long ago it was realized that the Pascal-esq single-point-of-entry, single-point-of-exit philosophy just created more problems than it solved (despite being an excellent way to teach disciplined programming, all you bottom sub'ers would get killed by Pascal). Relaxing it to Single-point-of-entry, multiple-points-of-exit (as perl does) makes for a much more "natural" feel, and avoids a whole host of bogosity, like the loop and a half problem, and avoids silly programming habits, some of which are well demonstrated in your WTF code.

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^2: Paid for crap
by wazoox (Prior) on Jan 25, 2007 at 21:28 UTC
    blockquote>VB (pre dotNet anyway) doesnt have a return statement, and normally relies on goto on err type logic for exception handling.

    I don't know VB but I find this very surprising; 25 years ago my good ol' Microsoft MSX BASIC 1.0 had subs (that you'd call with GOSUB) and RETURN statements. Of course you couldn't name the subs, you had to rely upon line numbers :)

    10 CLS 20 INPUT "choose a number", A$ 30 IF A$>10 GOSUB 100 40 if A$<5 GOSUB 100 50 PRINT "you typed ", A$ 60 END 99 REM the following 2 lines are a subroutine! 100 PRINT "you must enter a number between 5 and 10" 110 RETURN

    Wow, I couldn't imagine I remembered that sh*t so well, should have been 20 years :)

      Return doesnt return anything in the sense of a modern language would use return, it returns control to the next execution point.

      The moral equivelent of the MS basic 'return' would be 'exit sub' iirc. But this isnt the site for this discussion :-)

      ---
      $world=~s/war/peace/g

        The moral equivelent of the MS basic 'return' would be 'exit sub' iirc. But this isnt the site for this discussion :-)

        But IIRC there is a BASIC parser for Parrot, right? Isn't it the right site to talk about the marvels that we may do using Parrot? :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://596443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-06-20 01:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (93 votes). Check out past polls.

    Notices?