My programming sifu can kick your programming sifu's ass

Ovid on 2005-10-18T06:00:43

Motivated by the latest silly comments on Slashdot, I decided to write a little bit about programming language wars.


other languages

mary.poppins on 2005-10-18T20:14:42

There is another class of languages besides Perl, Java, and C++: statically-typed functional languages. In particular, ocaml hits a terseness/performance spot that is great for many applications in my opinion, including most current uses of C++.

Also, ocaml's option type is way better than perl's undef. We hates undef!

Re:other languages

Ovid on 2005-10-18T20:45:00

I think undef would be fantastic if Perl better supported three-value logic. Right now we have true or false. If Perl natively supported "true", "false" and "unknown", many problems could be made simpler.

I did allude to other paradigms (logic programming, to be specific), but I confess that I don't know much about OCaml.

Re:other languages

mary.poppins on 2005-10-19T05:24:01

My unhappiness with undef is that I can never remember whether my functions return undef or not, and what the behavior of the function is when given an undef arg, etc.. In the end, I always end up having to write comments.

Ocaml has a nice distinction between a type "foo" and a type "foo option" -- the latter can be undef, whereas the former is guaranteed to have a value:

let succ_int i = i + 1;;
let succ_int_option o = match o with
| None -> 0
| Some i -> i + 1;;

Re:other languages

Ovid on 2005-10-19T05:37:49

Keep to a strict convention and it's easier to remember. Don't return undef or a false value when you mean false, just return. A bare return will return undef in scalar context and an empty list in list context. By keeping to this convention, you can simplify your code. If you're returning from a ternary operator, use parens:

return;
# or
return $val ? defined $val : ();

Personally, I usually return as soon as I know a function will fail and I don't get to the ternary operator too often (though that's not always the case. Depends upon what I'm working on).

Just to pick...

Purdy on 2005-10-18T20:52:29

In your post, you have a few arg's on why Java has problems. IMHO, you weaken your argument when you say things like:
Java languished for a long time without regular expressions.
That's past tense - it doesn't matter unless the current set of regular expression functionality isn't stable or as fully-featured. If it is, say that, instead of talking about how Perl was great against Java v1.0 (or whatever).

I liked how one /. poster said:
The regular expression support of languages like Python, Ruby, and even C# trump that of Perl.
Can (s)he back that up?

I guess it's kinda funny (and sad) how both sides flex their "muscles" and slip into exaggerated representations of how good their language is or how bad their non-language is.

We need to rise above that, keep producing excellent proofs of concepts, and remain true to that great adage, "Other languages don't have to suck in order for Perl to be good."

Peace,

Jason

few times

Qiang on 2005-10-19T02:53:51

few times i don't see people bashing perl on slashdot. this is one of them. is perl 6 development shutting down those trolls or what ;-)