Live data from Hacker News

Why I Use Perl: Reliability

modernperlbooks.com

181–190 of 196 posts

Re: Why I Use Perl: Reliability

#181
post #155
post #86

Earlier quoted context omitted.

> Based on the examples, I presume xrange(x) is every integer up to but not including x Yes. That makes my Python example incorrect(should be xrange(2, num + 1)) > 1..^$x in Perl 6, don't recall if that's the Perl 5 syntax or not. Perl 5 doesn have 1..^$x. I have always used 1..($n - 1) where I needed it - don't know if there is a better alternative.

> Yes. That makes my Python example incorrect(should be xrange(2, num + 1)) Or just xrange(num) and then, as in my original code, output *= num + 1. :-)

> Or just xrange(num) and then, as in my original code, output *= num + 1. :-)

HN ate your asterisk(it uses asterisk to mark italics), or something wrong with my chrome app for HN. In your post, I saw:

    def Factorial(x): output = 1 for i in xrange(x): output = (i + 1) return output

Re: Why I Use Perl: Reliability

#182
post #117

Earlier quoted context omitted.

Is "my ($self, $a, $b) = @_" really that hard to read? It's slightly more characters but I've never found it particularly annoying.

The problem is in practice @_ is abused like crazy. For example: 1) I've often seen people shift from @_ half way in the middle of a function. If you really want to be certain about a method's formal parameters you have to read the entire function. 2) Also @_ is used in other circumstances which can cause mass confusion. For example Try::Tiny uses @_. It is difficult to guess if you getting a formal parameter or some…

As for named parameters, the clean/simple style I like to use is:

do_stuff(Foo => 1, Bar => $baz);

sub do_stuff {

    my %args = @_;

    my $foo = $args{Foo};
    # etc...
}

Re: Why I Use Perl: Reliability

#183
post #173

Earlier quoted context omitted.

My old CTO would have argued with you that Perl was not a mere scripting language* and that our shop's style of coding was indeed object oriented. The other problem we ran into was that the programmers who loved other languages were very religious about it. In fact I use to visualize that each programmer worshipped the specific animal that shown on the O'Reilly book cover: And I'm still haunted in my dreams by that c…

"that our shop's style of coding was indeed object oriented" All of the other languages I mentioned are roughly as OO as Perl. (You sometimes have to go looking for it, and Perl's probably ultimately the weakest at the core, but it's still there and mostly strong enough it doesn't matter.)

Well keep in mind that the above quote was made about twelve years ago. The problem that we had was that the people who would take up languages like PHP were what we'd call "script kiddies" who would copy and paste code and call themselves coders. Keep in mind that this was right before the bubble burst so there was a ton of BS going around too. Of course since that era I've seen programming languages mature -- and I've also seen the industry mature as well. Although i still see a great deal of BS... : D

Re: Why I Use Perl: Reliability

#184
post #180

Earlier quoted context omitted.

I completely agree with your first statement, but I have no idea how you get to your final statement from that. Ocaml and haskell are both on the "shoot self anywhere protection" end of the language spectrum. I used ocaml for a couple years and program in haskell for a living, and I assure you I am not in the top 5% of programmers.

Well, they are, but they fall into the "Designed for Top 5% of Programmers" trap. Basically - it's a balance - don't be too dumb, but don't be too clever either. I'd submit Python as being solidly in the middle ground here.

I still don't understand what you mean. How are they designed for the "top 5%"? And how does that mesh with the fact that I am certainly not in the top 5%, and yet program in haskell for a living? Ocaml in particular is very simple and easy to learn and use, haskell is only more difficult in the sense that it is a higher level language than say, python, so obviously you need to learn higher level abstractions. That's like saying python is written for some elite class of programmers because it has "strings" and C doesn't.

Re: Why I Use Perl: Reliability

#185
post #180

Earlier quoted context omitted.

Well, they are, but they fall into the "Designed for Top 5% of Programmers" trap. Basically - it's a balance - don't be too dumb, but don't be too clever either. I'd submit Python as being solidly in the middle ground here.

I still don't understand what you mean. How are they designed for the "top 5%"? And how does that mesh with the fact that I am certainly not in the top 5%, and yet program in haskell for a living? Ocaml in particular is very simple and easy to learn and use, haskell is only more difficult in the sense that it is a higher level language than say, python, so obviously you need to learn higher level abstractions. That's…

I would posit that you are in the Top 5%. Can you imagine your average PHP web dev trying to grok monads? In the at-times echo chamber around here it's easy to forget just how many people make a living righting VBScript macros, Java, or Cold Fusion, or whatever non-sexy language you want to name.

Re: Why I Use Perl: Reliability

#186
post #185

Earlier quoted context omitted.

I still don't understand what you mean. How are they designed for the "top 5%"? And how does that mesh with the fact that I am certainly not in the top 5%, and yet program in haskell for a living? Ocaml in particular is very simple and easy to learn and use, haskell is only more difficult in the sense that it is a higher level language than say, python, so obviously you need to learn higher level abstractions. That's…

I would posit that you are in the Top 5%. Can you imagine your average PHP web dev trying to grok monads? In the at-times echo chamber around here it's easy to forget just how many people make a living righting VBScript macros, Java, or Cold Fusion, or whatever non-sexy language you want to name.

>Can you imagine your average PHP web dev trying to grok monads

Your average PHP web dev is not the cutoff for the 95th percentile. But yes, I can imagine them trying to understand monads. I have also observed them succeeding at understanding monads. They aren't hard to learn, just something you need to learn. Being able to learn simple things doesn't make you the top 5%.

Re: Why I Use Perl: Reliability

#187

I've used Ruby, Java, and Perl professionally and my favorite by FAR is Perl.

have you tried Python? I find it far more "normalised" than Ruby, Perl or Java.

Not yet, right now I have no need to learn yet another scripting language. I've been spending most of my language learning efforts on Erlang lately.

Re: Why I Use Perl: Reliability

#188
post #89

Earlier quoted context omitted.

That's a feature, not a bug. Write-protecting memory areas using mprotect() and the like, and handling the resulting SIGSEGV, is a popular technique for implementing a write barrier needed for generational garbage collection.

I've seen it used before to good effect, but one concern is that it's really easy to write flaky and unsafe signal handlers. Getting that right has never seemed easy to me.

It's very easy to write flaky and unsafe memory management code in general, yet memory management is used with good results in nearly every production system. And there's nothing wrong with using "tricky" OS and hardware services to implement language runtimes and core libraries --- that's what they're there for.

Re: Why I Use Perl: Reliability

#189
post #185

Earlier quoted context omitted.

I still don't understand what you mean. How are they designed for the "top 5%"? And how does that mesh with the fact that I am certainly not in the top 5%, and yet program in haskell for a living? Ocaml in particular is very simple and easy to learn and use, haskell is only more difficult in the sense that it is a higher level language than say, python, so obviously you need to learn higher level abstractions. That's…

I would posit that you are in the Top 5%. Can you imagine your average PHP web dev trying to grok monads? In the at-times echo chamber around here it's easy to forget just how many people make a living righting VBScript macros, Java, or Cold Fusion, or whatever non-sexy language you want to name.

"Cargo cult" programmers don't grok strong typing or lexical scoping either, but that's not a good argument for a weakly typed, dynamically scoped language.

Re: Why I Use Perl: Reliability

#190

Earlier quoted context omitted.

Ah yes, SBCL, the runtime that manages memory with a signal handler on SEGV. Stable!

Java does that, for null checks.

The CLR uses a similar technique on Windows[1].

[1] http://blogs.msdn.com/b/oldnewthing/archive/2007/08/16/44070...

Post reply on HN