[Tutor] Are you allowed to shoot camels? [kinda OT]
Alan Gauld
alan.gauld at freenet.co.uk
Thu Feb 3 09:59:28 CET 2005
> Just wondering if I should bite the bullet and code from scratch in
> Perl, or if my Python - Perl is Ok.
Its nearly always a bad idea to just translate code structures from
one language to another. It will usually be sub optimal and non
idiomatic - thus harder for the 'native' programmers to
understand/debug.
Bjarne Stroustrup made the same observation when C++ first came out
and lots of Smalltalkers tried to use it like Smalltalk. He said
"C++ is not Smalltalk, if you want to write Smalltalk use smalltalk"
> 1) I'll use Perl for the regex stuff from now on, Perl is obviously
> built for this.
Yes, or PHP. Both have RE baked in.
> 2 ) There's More Than One Way To Do It makes debugging hard - i.e.
> close INFILE; & close (INFILE); are both valid. I like one syntax,
cos
> it's easier to remember.
I can cope with that - BASIC does the same kind of thing - but
its the zillion ways to handle errors that bug me!
do thing until die
do thing or die
die unless do thing
etc....
> 3) Some stuff is counter-intuitive -
A huge understatement! :-)
> Also, why doesn't if ( not $d eq "a" && not $d eq "c") evaluate to
I don;t know but in cases like these I use parentheses like amaniac:
if ( ((not $d) eq "a") && ((not $d) eq "c") )
Or did you mean
if ( (not ($d eq "a")) && (not ($d eq "c")) )
Or was it
if ( (not $d) eq ("a" && not ($d eq "c") ) # OK thats a bit
unlikely...
> 4) WHAT IS WITH THE STUPID SYMBOLS EVERYWHERE LARRY??!!
Clever abbreviations apparently!
I don't even like the $ and @... one reason I can never quite feel
happy with Ruby. It has fewer of them but still more than I like.
> In my opinion, there's only one place a > sign should be, in an
> inequality test.
Nope, I'm quite happy for it to be used in file indirection and
even for right/left bit-shifting. But I don;t like it being part
of the filename - I agree with that!
> great for regexes
> obviously based around *nix conventions.
> Big hodge-podge, oozing with inconsistency. I'd hate to work
> collaboratively on a Perl project.
> Two steps up from Brainf**k in parts.
> Obviously in need of a benevolent dictator a la Guido.
Good summary! Perl reflects the fact that its inventor is a
natural-language student not a computer scientist. It tries to
incorporate the "richness of expression" of natural spech.
But when dealing with machines that's a flaw IMHO!
Alan G.
More information about the Tutor
mailing list