Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So here's the thing, Larry Wall is not only a programmer, he is a linguist. That's reflected in the myriad of ways that one can write something in Perl, reflected in the common refrain at YAPCs the world over, "TMTOWTDI" (There's More Than One Way To Do It). But because of the flexibility Larry designed into the language, there's also "more than one way to do it" ...wrong (ok, not "wrong", but so complicated and whacky that Joe programmer 10 years from now wouldn't have a clue about). But this very flexibility gives Perl a unique beauty.

I don't think it's the language's fault that poor code exists to teach people the way to Perl zen. It's more that scripting languages themselves lend to one-offs and poor code writing, especially in the days of early Perl, when people were giddy to get their hands on something that wasn't as ugly as "sh". We need better programmers who are not "too busy to write good code" as well as better material.



This line of reasoning is old and tired. Natural language is a bad enough way to communicate with people, it's a ridiculous way to communicate with machines which take everything literally and treat everything implied to mean "crash in amusing and unforeseeable ways".

One of perl's big "natural language" claims is that things mean something different in different context. I think there are several movies based on what can happen when two people have a conversation but have a context mismatch.


> Natural language is a bad enough way to communicate with people

If it was bad, it wouldn't have become the way to communicate with people in every culture on the planet. Don't forget "natural language" can include body language, as well as words, grammar, idioms, stresses, pause, and intonations.

> there are several movies based on what can happen when two people have a conversation but have a context mismatch

Matching context using protocols such as small talk before a main topic of conversation is also part of natural language. Many of us who work on computers don't learn these other aspects of natural language very well, and tend to project this limited command of natural language onto computer languages.


>If it was bad, it wouldn't have become the way to communicate with people in every culture on the planet.

We have nothing better, but it is not the only way we communicate. Mathmatics made a whole other language to communicate with because spoken language wasn't effective enough.

Further, natural language is useful among people because we can work out meanings, fill in implicit statements closely enough, have experience on what certain phrases mean and so on. Even with every tool we have, we often still get it wrong. So if it takes so much intelligence to be able to communicate with written language, why would anyone imagine it a good idea to expect computers to be able to do this too? A computer must explicitly be told what to do in every situation. Typically when we need to go into that level of detail with people we don't use natural language either. We generally demonstrate what must be done (e.g. youtube tutorials which often don't even have sound, etc.).

>Many of us who work on computers don't learn these other aspects of natural language very well, and tend to project this limited command of natural language onto computer languages.

Is that a rock thrown at me? I don't think I have a problem here. I'm just realistic about what language is good at. Natural language's value is that it can be very concise when everyone has the same context as you. With a computer this is never the case.


>If it was bad, it wouldn't have become the way to communicate with people in every culture on the planet.

That's because the vast majority of social situations are very tolerant of misunderstandings and have lots of redundancy/repetition to ensure that communication occurs successfully.

In cases where misunderstandings can be significant, we turn to more formal modes of communication. Scientific literature, technical manuals, and legal documents are all more stilted than regular prose for the simple reason that they need to clearly and unambiguously communicate their contents. Reader enjoyment is a secondary consideration.

Programming languages need to be even clearer than legal or technical documents, because they're being read by a machine rather than another person. As such, I see ambiguity in programming languages as even more of a sin than ambiguity in contracts and scientific papers.


I'm not saying it's good or bad, all I'm saying is that it was Larry's choice when developing the language.

Here's a great example of C++ meaning different things in different contexts. How about this:

    int *& p;
    *&p;


One is a declaration, one is an expression. And, believe me, I taught C++ for a while and this already causes a lot of confusion.


Seriously?! Someone downvoted this statement? It was completely factually true. People do indeed get confused by the difference between declarations and expressions. That's why some languages don't like to have that distinction.

With things like this I would like to advocate that Perl be treated as politics: something that's just not appropriate for HN. The thing is, when ever perl comes up some of us point out why we don't use it anymore but perl fans get seriously emotional about perl and start downvoting things they disagree with (much more so than ordinarily happens). I really suspect that if it weren't for the downvote limit some perl fan would have gone through and downvoted all my posts by now.


If you want to see sensitive, there are other language communities you should troll instead...


Huh,

The problem is not whether Perl or C++ is bad. All languages have their own use cases. When their use cases go away, nobody feels the need to use the language. That's the golden rule for any language/tool that exists out there.

Perl, C++ and even lisp even over a half a century are still alive out there because there are use cases that those languages serve very well. And a majority of the people feel compelled to use them. The reason why people troll is they feel they can convince others not to use the language they hate.

C++ has a lot of problems, but compared to the other languages advantages it offers are many and it doesn't quite really have good competitors in those areas. We can go and talk about various other languages that you can compare with C++. But language itself is nothing. The surrounding ecosystem, libraries, books, help, availability of programmers, the total weight of the community with their combined wisdom over the years. In all those parameters, syntactical problems of a language count for very little things in the real world. There are more than sufficient real world scenarios out there where C++ has done the job exceedingly well.

I have myself maintained large C++ applications. And have faced many problem like what others have mentioned before. But given our efficiency requirements, Java wouldn't last for an hour in our production environments. And given all the conditions I mentioned, there isn't really a clear alternative apart from C++. And I'm sure vast majority of the C++ project have the same reasons to use C++.

Perl has its own niche. I don't really have time to write 100 line of Java/Python code with piles of exceptions of handling code just to read a file. I don't have time or the patience to deal with alien integration of Regular expression that Python offers. Python has other problems, It never evolved as a rapid scripting language, I still can't consider using python as a prototyping language. It has a little posh gloss to it. Python has nothing even remotely closer to CPAN. Compared to Perl, Python is no where in syntactical flexibility. Perl's documentation is just awesome, support for newbies is too good. And they seem to fixing all the problems in the new language Perl 6. I use scripting for rapid tasks which need urgent attentions. Some of that gets converted to production work. If that rapid aspect is missing I don't really consider that language a scripting language. And serious scripting language will have to provide means of easily modifying data of all kinds text especially. And also provide seamless integration with the Operating system.

Python never provided me all this. Its never could become my primary scripting language.

But I appreciate Python's other use cases. It has some awesome frameworks. And it has a very easy verbose syntax. And I'm sure it has plenty of use cases for people around.

Now just because you like Python, don't go on endlessly trolling Perl. This has a been going for a decade now and is getting a little boring. Both language have their use cases and are likely to be there for a real long time. Whether you like it or not.

As Bjarne Stroustrup mentions in his "The C++ programming lanaguage" - You must learn C++ not for a new syntax to do old things, but to build better systems.


I don't use Python, Ruby or any other scripting language unless someone pays me to. I was simply responding to inaccurate or tautological statements thrown around in this thread.


Huh?

I commented on a bad troll that wrote 10++% of all comments and made sweeping personal attacks.

I assume you wanted to comment on the same comment as me? :-)


:)

Yes, I think by mistake I hit the wrong reply button.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: