http://qs321.pair.com?node_id=241874


in reply to (A6) Perl 6, a general-purpose language?

I'm not sure I understand you correctly. You explained that optimization counts. C and C++ don't have JIT in their most common forms, as far as I can see. Do you mean that Perl isn't as fast as C and C++ in some domains?

Detailed typing is harder to understand. If anything, I think the type system in C and C++ is one of the worst features of the language. To do anything useful, you're forced to cast willy-nilly. The templating system in C++ is a symptom of the problem. It's a combinatorial explosion based on exposing low-level implementation details. (I think this may be an example of premature optimization -- by forcing you to commit to an int early on, you're restricted in what you can do in many other places around the source code. You can guess at what you'll need later, but if you guess wrong, you have to make a lot of changes, so you'll end up hedging your bets or editing a lot of code or sucking it up and living with your limitations.)

Java's even worse -- it suffered along without templates for years and years. How long did it take before you could put an object in a container without having to upcast? You could also look at all of the work you need to do with the Reflection API to do something like a Factory pattern.

This is turning into a rant on a subject which many people have strong feelings (and I really don't want to debate the benefits of strong versus weak, static versus dynamic typing here!). I'll try to sum up.

In my opinion, Perl is already a general purpose language. There are several benefits of Perl 6 that improve its position: easier distribution of code, easier embedding and extending semantics, improved performance through Parrot, and higher-level programming constructs.

If anything, I'd much rather use a dynamically typed language as a general purpose language.

Replies are listed 'Best First'.
Re: (A6) Perl 6, a general-purpose language?
by crenz (Priest) on Mar 10, 2003 at 23:22 UTC

    Do you mean that Perl isn't as fast as C and C++ in some domains?

    Well, yes. There was yet another discussion about it recently (Confirming what we already knew). A6 made me wonder whether debates like that one might actually go away (well, they never will, but they might become more pointless).

    Update: C/C++ already does produce optimized native assembly code. Java IMHO becomes more useful through JIT compilers. I hope the same thing for Perl 6.

    Detailed typing is harder to understand.

    I'm not saying that I like the type system in C++ or Java. And if you got the impression I want Perl 6 to be like that, I certainly expressed myself in an utterly obfu way :). What I mean is that things like interfacing with system libraries usually require strict and detailed typing. So far, there was always a need for C to do it. I wonder whether the goal is actually to eliminate the need for C for these purposes and do it all in pure Perl 6.

    In my opinion, Perl is already a general purpose language.

    Well, we still see a lot of software nobody would care to write in Perl. (I mentioned some examples.) I'm not really saying that Perl should become a language you can write an OS in, I'm just wondering where we are heading.

    If anything, I'd much rather use a dynamically typed language as a general purpose language.

    I agree. Strict typing (hopefully) is going to be the exception. But sometimes, you need the exception.

      I'm not really saying that Perl should become a language you can write an OS in

      Good, because anything you can write a half-decent operating system in is NOT a general purpose programming language. It would be far too low-level to be useful.

      Perl, on the other hand, is definately general purpose. If you want evidence of this, look at the CPAN. Image/audio manipulation to web crawling to processing hundreds of file formats to cgi scripts to mod_perl to natural language processing and back again. If that isn't general purpose, what is?

        Good, because anything you can write a half-decent operating system in is NOT a general purpose programming language. It would be far too low-level to be useful.

        Yes, that's why I am always astonished why people keep on writing apps in C ;-)

Re: Re: (A6) Perl 6, a general-purpose language?
by Jenda (Abbot) on Mar 11, 2003 at 12:59 UTC

    You should not take the 30 years old "type system" you get with C++ or Java as an example of a strict type system. There are much much better ones. Look at ML or Haskel or ... These are general enough that you do not need to bend backwards (ie. typecast) all the time to get anything done.

    If Perl6 stole from those, including stuff like type inference, you would not even notice it's suddenly strict. (Well until you'd do something spicy with eval"" of course.)

    Jenda

      I'd like to think my criticisms were just specific enough to leave the door open for a good strong typing system. Of course, I did write Class::ActsLike. :)