Flutterby™! : Perl 6

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Perl 6

2001-10-06 14:39:29+00 by TC 4 comments

A few tidbits of what Perl 6 will look like. Wow that default operator looks very useful...

[ related topics: Web development Perl Open Source ]

comments in ascending chronological order (reverse):

#Comment made: 2002-02-21 05:32:56+00 by: ebradway

To my lingua franca: C eyes, they are making Perl worse. I lost a major customer over this little problem:

if ($return_code == "R16") { return }

Which should have been:

if ($return_code eq "R16") { return }

The first example was evaluating true for any value of $return_code that began with 'R'. The second evaluated correctly. This was in my negative database checks - where I was supposed to deny checks on accounts that have unresolved returned checks.

C uses syntax one way and never tries to 'interpret' what you are doing. Perl likes to make a best guess at it and if you make a mistake like this in your code you end up with bad results (like I did).

Of course, in C you can still make this mistake:

if (return_code = 'R') { return; }

Instead of:

if (return_code == 'R') { return; }

Dan always liked to do this:

if ('R' == return_code) { return; }

which would create a compiler error if you accidently did this:

if ('R' = return_code) { return; }

I prefer the 'sparse' syntax of C. It is harder to do some things but you don't get code that looks like cartoon characters cursing.

#Comment made: 2002-02-21 05:32:56+00 by: Dan Lyke

Stronger typing is one of the drives behind the internals redesign that's pushing Perl 6. I agree, I've been bit by the type being contained in the operator rather than the variable before.

On the other hand, once I got down all the funky characters, I rarely have the "how do I express this" conundrum in Perl that I often have in C. The Perl code I write usually works the first time. I don't often use the debugging facilities in Perl, and even though I'm a pretty good C coder I usually find GDB or similar indispensable when I'm writing C.

But largely I see the strengths of both as pretty disjoint. As I get back into situations where I write more UI code, I'm looking around for an appropriate middle ground. Maybe if I get more familiar with the STL and templating C++ will provide that; I don't think Java will.

#Comment made: 2002-02-21 05:32:57+00 by: meuon

More freaking perl 'magic' to remember and contend with.. But I love it anyway. But I am just a lowly Perl wannabe that finally started using hashes correctly :)

#Comment made: 2002-02-21 05:32:57+00 by: ebradway

True, I almost never use the Perl debugger and I've never had a buffer overflow error. If I can get all of my code running under '-w' I would be happier but it's all inherited code that wasn't written to '-w' standards.

I still find Perl to pretty much be a 'write-only' language. C isn't much better but with C you approach every problem with a much smaller set of operations and no magic variables or crazy type-shifting. I run into the most trouble in Perl when I'm coming behind programmers who know a wide range of the syntax, use magic variables, and don't comment the code. This is what bothers me about Perl 6 - the addition of even more operations.