|Welcome to the Monastery|
Re: Perl 6 is too complexby BrowserUk (Pope)
|on Mar 14, 2003 at 20:19 UTC||Need Help??|
Too complicated? Hmmm. Could be, but how good is your memory?
If I strain, really hard, to remember. Almost every time I encountered something new in my life, whether it was long division, Naper's Bones and logarithms at school, driving a car as a teen or Perl's regexes rather more recently, it always seemed too complex at the start. That usually continues for a period of days, weeks or months, and then one day I realise that I've stopped thinking about how complex it is. Often as not, what makes me realise that I have stopped thinking about the complexity, is when I find myself wishing that I could do something in a cleaner, more concise,more transparent or more efficient way. At some point in between, I made the transition from wishing it was less complex, to wanting to add a complexity to the syntax, in order that I might capture another semantic without having to restructure what I have.
The thing I personally enjoy about using perl 5, is that--more than any other language I have used or seen (with the possible exception of APL)--it allows me to express each step of an algorithm in the same way that I think of it, rather than having to break it down into a series of sub-steps. The reason that recursion is elegant, is that in many situations it allows us to specify the algorithm in a clean, concise manner which makes it easier to get right first-time, easier to understand for those that come along after. The penalty, unless the programmer (or compiler) takes special care, is efficiency.
The benefits I see coming from what I have seen of Perl 6, is that in your first pass, you can write the algorithm in a concise notation without needing to use the addition syntax. Then, when the thing is working, if it proves to be less efficient than required, the new syntatic elements allow you to add a few additional clauses to the existing code, that will allow the compiler to improve the efficiency without requiring you to substantially modify the original algorithm. You'll be able to indicate that this variable is a number and will never be used as a string, so omit all the overhead that allows me to use it as a string and the resultant code will become more efficient. Or this parameter will be used read-only, so the compiler can omit the overhead of creating an alias for it and again the same code becomes more efficient.
Efficiency isn't the only benefit that will be available from the new syntax. As LW indicated, for those S&M types (his phrase, not mine:), for whom strong typing, contract enforcement etc. are either desirable or essential, the new syntax allows (without requiring) much of this to be done by the compiler at compile time, rather than requiring additional statements at runtime. I can see some development shops adopting coding standards that will make some of these things obligatory for their coders. The beauty of it, if I understand what I have read so far correctly, is that Perl 6 will allow such strictures to be applied where they are needed, desired or beneficial, without requiring it where they are not. The proverbial "having your cake and eating it".
LW is walking a fine line. From my interpretation of what I see, he's well on his way to acheiving many of the desires of the many, whilst retaining the spirit of the language. Like many others, I could argue against some of the decisions, but I'm more than willing to keep an open mind and wait until I get the opportunity to use the language before I make any judgements. Perl's track record of adopting and adapting the best of the rest and inventing new where required, as well as backing out experiments that fail, is strong enough to allow me to swallow those fears I might have now, until I get to try things for real.
Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.