Live data from Hacker News

Programming is hard, let's go scripting..

perl.com

61–70 of 96 posts

Re: Programming is hard, let's go scripting..

#61

Earlier quoted context omitted.

Object oriented, functional, declarative you say it Perl has it. Its amazingly flexible, easy to learn and extensible. My first programming job was in Perl back in the late 90's. Loved it, but I have to say that the OO facilities left something to be desired. I found them fatiguing. It took Java, then Smalltalk for me to really get OO. Perl requires too much mastery of mechanism just to do objects, so it's not the be…

I agree with chromatic below; Java and C++ do not teach you OO. They teach you cut-n-paste without a text editor. (When Bar extends Foo, you're copying-and-pasting Foo's code into Bar, and then tweaking it. Or at least that's how class-based OO is used a good percentage of the time.) A better way to program is with interfaces and composition via delegation, something that Java and C++ support but have no syntax for m…

Really? I see inheritance as a good antidote for cut'n'paste. If you don't physically duplicate code, you'll never have to read both copies just to make sure they're still the same. I agree most devs do it wrong, but I think it's because they're purely pragmatic and haven't read or thought philosophically about the open/closed principle, programming-by-difference, Liskov-substitutability…

And I do want to remind readers that Moose is not the Perl object system, it's an object system added on top of the mess that a huge collection of legacy code presumes.

Re: Programming is hard, let's go scripting..

#62
post #60

Earlier quoted context omitted.

What you're saying seems handwavey and imprecise. What -- specifically -- is wrong with regular expressions and file operations in python? How is white space parsing "not good" for large and nested code blocks? (And why do you have large nested code blocks in the first place? Break those up! Those are hard to read regardless!) And how is there a "java feel"? What does that even mean? And in what way is python verbose…

'Programming languages teach you not to want what they don't provide.' -- Paul Graham

Its a lovely quote, but I've used Perl, I know what it provides. I've also used lisp. I just think if you're going to make a claim you need to back it up with something solid.

Re: Programming is hard, let's go scripting..

#63
post #42
post #29

Earlier quoted context omitted.

Back-compat can have many meanings - but my understanding is that every major release does break some back-compat in some way - otherwise it would not be a major release. And if you think that binary compatibility is not be fair - then how about pseudo-hashes? This is not to say that I don't agree that Perl has perhaps the best back-compat of all the languages that still evolve - but these absolute statements have th…

I think pseudo-hashes were always marked as experimental, up until they were removed. That said, I'm pretty sure you're right that backwards Per 5 broke backwards compatibility with Perl 4 (and presumably 4 with 3, etc.)

From what I've read various places (but can't find a reference at the moment), the version bump from 3 to 4 was just to be able to have the Camel book coincide with a major version (i.e. "this book describes Perl 4" instead of "this book describes Perl 3.1.4.1.5" or whatever).

Re: Programming is hard, let's go scripting..

#64
post #55

Earlier quoted context omitted.

Although Python is taking more of these roles over time, Perl is still the thing that holds much of the internet's infrastructure and tools together, as well as internal servers, so it's a good thing to know if you're interested in all that.

Hmmm, Python has some great frameworks and is a great language. But unfortunately, its almost like going backwards. Perl was invented because C + Unix text processing utilities together were not proving to be good for many tasks like Text processing, fast prototyping etc. Now using another C based language which doesn't do that, takes us back to the old problem again. IMO, Python doesn't solve those problems. Regex s…

"No equivalent of CPAN."

Not exactly the same, but the standard library is extensive:

http://docs.python.org/library/index.html

There is pypi:

http://pypi.python.org/pypi

whose packages can either be installed directly or with pip.

Re: Programming is hard, let's go scripting..

#65
post #60

Earlier quoted context omitted.

'Programming languages teach you not to want what they don't provide.' -- Paul Graham

Its a lovely quote, but I've used Perl, I know what it provides. I've also used lisp. I just think if you're going to make a claim you need to back it up with something solid.

I gave you the solid things, but you give 'You aint gonna need it' kind of answer to everything Python doesn't have.

Coming to asking people forcefully shorten their code blocks. It's none of language's business to dictate its style on me and steal my freedom. A language is supposed to behave the way I want. That's its very purpose.

No multiline lambdas, No CPAN equivalent, Seamless interaction with shell like $output = `command` is absent. No first class regular expressions. Lack of ability to provide the command line power Perl gives. No switch statement, No equivalent of Perl's smart match operators, Nothing like Moose, Nothing like Devel::Declare, Parsing power nowhere even near to Python. And I can go on and on..

I guess these are solid enough things(at least for me)

Re: Programming is hard, let's go scripting..

#66
post #48

Earlier quoted context omitted.

Nope, I'm being more general. Throw darts at random programming ads. Take that job. Chances are, it will be something like "move QUUX formatted records from BAZ mainframe to new Oracle Windows Java 7.0 Lightweight Enterprise Server", rather than "start completely anew to help elementary school students learn calculus". Things like ad-hoc record parsing and network connectivity and the ability to easily fork() end up…

What you say is indeed true, if you take a monolithic approach to problem solving. And I tire of this approach--dammit, we're tool-builders! We have been shown the Unix Way, and yet we ignore it time and again, forcing us into suboptimal solutions to our problems. Moving "QUUX formatted records from BAZ mainframe to new Oracle Windows Java 7.0 Lightweight Enterprise Server" involves these things: a source, a sink and…

You are assuming the people that are being asked to write this code have the power to choose anything about the code or platform they use.

Re: Programming is hard, let's go scripting..

#67
post #55

Earlier quoted context omitted.

Although Python is taking more of these roles over time, Perl is still the thing that holds much of the internet's infrastructure and tools together, as well as internal servers, so it's a good thing to know if you're interested in all that.

Hmmm, Python has some great frameworks and is a great language. But unfortunately, its almost like going backwards. Perl was invented because C + Unix text processing utilities together were not proving to be good for many tasks like Text processing, fast prototyping etc. Now using another C based language which doesn't do that, takes us back to the old problem again. IMO, Python doesn't solve those problems. Regex s…

> Regex support is really bad in Python

More verbose than Perl? Yes.

Bad?

    for x in re.findall(r'\d+', '12 drummers, 11 pipers'):
        print x
How is this bad?

> file operations are not trivial.

File operations are trivial and well designed. You know, there is much more to file operations than in-place substitute.

> There is too much of Java feel to it

Bullshit.

> and it just doesn't have the feel of bash/perl/awk's scripting powers.

Want it to feel like Perl? Don't bother - use perl.

> Scoping is just not right.

Scoping doesn't require your testimony.

    # foo doesn't exist
    if blah:
        foo = 'bar'
    # foo  exists if blah
This is perfectly fine.

> There doesn't seem to be a sane ways of evolution without breaking backwards compatibility.

When you change the semantics of the language, bozo syntax tricks don't help. Python 3 has semantic changes - syntax tricks aren't going to handle them.

> No equivalent of CPAN.

A large stdlib and PyPi.

> And in many ways white space based parsing is not good for large and nested code blocks.

Spaghetti will look like spaghetti, irrespective of whether block separators are braces or indentation.

> It still doesn't have multiline lambda's.

"still doesn't" sounds like it is something which is planned but not achieved yet. It is not something that Python designers are planning to incorporate in the language. Perl has multiline lambdas but I only used single line lambdas for sort, grep et al - anything larger than that becomes a named function. Unless you have blocks, multiline lambdas aren't used that much.

> And its too much do-it-one-true-way kind of language, that sort of is a blocker for quick hacking.

There can't be an objective explanation to a subjective statement.

> Because I like to write what I think, and not the other way around.

What's the other way round? I like to think what I write? So in Python you think what you write? That makes zero sense.

> The language is too verbose, and unlike Perl and Emacs there are no exponential productivity gains over time.

Complete, utter bullshit. There isn't a single language in the world where the productivity gains are exponential over a long time - there might be some when you are a beginner which gets capped pretty fast.

Re: Programming is hard, let's go scripting..

#68
post #67
post #55

Earlier quoted context omitted.

Hmmm, Python has some great frameworks and is a great language. But unfortunately, its almost like going backwards. Perl was invented because C + Unix text processing utilities together were not proving to be good for many tasks like Text processing, fast prototyping etc. Now using another C based language which doesn't do that, takes us back to the old problem again. IMO, Python doesn't solve those problems. Regex s…

> Regex support is really bad in Python More verbose than Perl? Yes. Bad? for x in re.findall(r'\d+', '12 drummers, 11 pipers'): print x How is this bad? > file operations are not trivial. File operations are trivial and well designed. You know, there is much more to file operations than in-place substitute. > There is too much of Java feel to it Bullshit. > and it just doesn't have the feel of bash/perl/awk's script…

I am going to neglect the responses 'Bullshit' basically because that means you don't have an answer at the moment.

>>There isn't a single language in the world where the productivity gains are exponential over a long time - there might be some when you are a beginner which gets capped pretty fast.

Sorry to ruin your party. But there are languages where there are exponential gains in productivity with time. Languages like Lisp, Perk, Haskell etc. But I can't convince that to people who can't look beyond 'readability matters' and consider that as the Pinnacle of programming language design.

Coming to regular expressions they are first class citizens in Perl. That is basically what takes them to the next level. Now scripting on Unix has always been so much about Text processing. That is how it has always been. tr, sed, awk and dozen other text processing utilities. And then there is Perl. If you are not getting 'Text processing' thing correct, then you already loose the scripting race with a very huge margin.

Perl added a lot of new semantics to the language too given/when statements, smart matching operators etc. Python broke it for as simple a thing as a print statement. That is the whole point(The language is too brittle to evolve). And I'm sure any new thing in Python is going to go the same way.

And stdlib is no where near CPAN. Although I agree PyPi is doing a good job.

You are right that I must use Perl,And you are also right that Python is an awesome language. There are great frameworks Twisted, Django, NumPy. I've used Twisted extensively. In many Python ways is a great language for web development, for studying algorithms(because its better psuedocode), and due to its frameworks like Twisted - its good for network programming.

But I am sorry to say Python doesn't do well in scripting areas. And it so happens once you start there and go a little deeper you can just go on and on with Perl.

Re: Programming is hard, let's go scripting..

#69
post #49

We think about extensibility a lot. We think about languages we don't know how to think about yet. But leaving spaces in the grammar for new languages is kind of like reserving some of our land for national parks and national forests. Or like an archaeologist not digging up half the archaeological site because we know our descendants will have even better analytical tools than we have. This quote, and what little I'v…

The book is significantly better...

(yes, I have nothing to add)

Re: Programming is hard, let's go scripting..

#70
post #68
post #67

Earlier quoted context omitted.

> Regex support is really bad in Python More verbose than Perl? Yes. Bad? for x in re.findall(r'\d+', '12 drummers, 11 pipers'): print x How is this bad? > file operations are not trivial. File operations are trivial and well designed. You know, there is much more to file operations than in-place substitute. > There is too much of Java feel to it Bullshit. > and it just doesn't have the feel of bash/perl/awk's script…

I am going to neglect the responses 'Bullshit' basically because that means you don't have an answer at the moment. >> There isn't a single language in the world where the productivity gains are exponential over a long time - there might be some when you are a beginner which gets capped pretty fast. Sorry to ruin your party. But there are languages where there are exponential gains in productivity with time. Language…

> I am going to neglect the responses 'Bullshit' basically because that means you don't have an answer at the moment.

Saying 'python feels like java' or 'exponential gains from switching language' is bullshit, and augmenting it with "calling it bullshit means you don't have an answer" is more bullshit.

> But I can't convince that to people who can't look beyond 'readability matters' and consider that as the Pinnacle of programming language design.

I don't remember mentioning 'readability matters' as being pinnacle of programming. You are responding to arguments you are imagining I am making.

> Sorry to ruin your party. But there are languages where there are exponential gains in productivity with time. Languages like Lisp, Perk, Haskell etc.

Get off your high horse. Lisp, Perl, Haskell aren't some exclusive club only you are allowed into. I have used Racket, Clojure, Python, Ruby etc. and if your gains are exponential accumulated over a period of 1 month between say Python and Racket, be assured you are a very lousy Python programmer. Let alone exponential, a gain of even 2x is quite a stretch. Why don't you put your money where your mouth is and show me your 'exponential gains'?

Post reply on HN