Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Perl 6 is too complex

by fruiture (Curate)
on Mar 15, 2003 at 16:27 UTC ( #243313=note: print w/replies, xml ) Need Help??

in reply to Perl 6 is too complex

As others said, the Apocalypses only highlight the changes. A real over-complication would mean e.g. to invent new assignation operators, make Hashes and Arrays just Objects held in scalars (%hash{foo} becomes $hash.get('foo')), to throw away all this list stuff at all ( @a = (@b,@c) becomes $a = array_merge($b,$c) like in PHP, bäh) . That would be horrible.

What does Apocalypse 6 introduce: Subroutines signatures, at last subroutine calls can be optimized at compile time, no more Perl's-subroutines-slowyoudown-trolls. This is nothing impractical, nearly every popular language has that "feature". Even more: named arguments, we're movng towards completely self-documenting code, and they can and will be optimized by the compiler as well: no memory- and time-consuming hashes to extract named arguments. This is no artificial invention, we know and love it from Perl5, a language with a lot of cool features we shouldn't forget ;)

Marking Arguments as constant: nothing new, plain old C 'const'. Marking them as rw: good old Perl5, access to parameters without messing around with pointers/references, no more than 'is rw', just as 'var' in Pascal. Slurpy lists using the * character: I already find that natural as the array flattening operator is the * as well.

Making arrays arrayrefs in scalar context: How logical, i didn't count how often newbies ask why 'function(@a,@b)' woudn't do what they want. It is straight-forward.

Seperating methods from subroutines does not only improve readability, it solves a lot of problems we had with OO (inheritance, private stuff, shooting your base class in the foot). It again allows optimizations at compile time. Other languages don't allow you too: In Java it's all methods, in Perl5 it's all subs; Perl6 lets you decide and get the optimum, you even have submethods.

Macros, old thing, known to be powerfull. They are no new concept.

Shortcut arguments ($^a ...) reduce the complexity without breaking the principles or would you rather like:

sort sub ($a,$b) { $a <=> $b } whatever #instead of sort { $^a <=> $^b } whatever

The latter is more or less nearly Perl5, only that you cannot break things when you use $a and $b somewhere.

In the end, it's not more complex than Perl5, but it can do more than Perl5 (and faster). As a parallel story: When I look at Perl5 formats, i think they're strange and their use is too complex (think of all the strange variables). I never used formats, and they never disturbed me for a few years of excessive Perl programming, althought they were always there. They'll be removed in Perl6 core (see Apocalypse 7 ;), because they've proven not to be too interesting for the majority of tasks. Why should things that turn out to be bloated theory disturb you in your work with Perl6? Just don't use them.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://243313]
and the fire pops...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2018-06-21 00:00 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.