Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Perl Programming

What is Perl 6? 343

chromatic writes "Perl.com has a new article entitled What is Perl 6?. It analyzes the changes to the language in light of the good and bad points of Perl 5 and provides new information about the current state of the project: Perl 6 exists, you can write code in it today, and it's more consistent and easier to use than Perl 5."
This discussion has been archived. No new comments can be posted.

What is Perl 6?

Comments Filter:
  • Re:What is Perl 6? (Score:5, Interesting)

    by Perey ( 818567 ) on Tuesday January 17, 2006 @02:44AM (#14488555)
    That's the thing, though. PHP is the big name (from management's perspective), at least in the P category of LAMP, right now. Not that Perl's gone away by any stretch of the imagination, but the existing Perl shops are happy to keep on doing what they're doing, while the PHP advocates crow about how many new jobs are being done in their language.

    So is Perl 6 going to bring about a Perl revival, or is it (as I suspect) going to fall flat when faced with Perl 5's quietly entrenched support and PHP's proclaimed grip on new uptakers? TFA mentions the reasons for cutting backwards compatibility (or at least reducing its priority) far too often for me to be optimistic there.

    I think Perl 6 will catch on, eventually... but it's going to be more of an alternative language, not an upgrade, to Perl 5 for a long time yet.
  • by BadAnalogyGuy ( 945258 ) <BadAnalogyGuy@gmail.com> on Tuesday January 17, 2006 @02:45AM (#14488560)
    I never really understood Data Structures until I learned Perl. I was consistently and thoroughly confused in my DS class. The language used there was C++. There was simply too much baggage in the language that obfuscated the very points we were being taught. If you can't get past the template syntax, how in the world are you going to be able to understand the data structure concepts?

    Then I met Perl (5.003). What a difference it made! The data structures were built in, and on top of that, it was EASY to nest structures to build complex data types. It was like having a semester of Data Structures immediately made clear.

    Then I found myself back with C++ again. First I wrote my own List classes. However I soon realized that STL made available exactly the types of data structures that Perl has. Maps, Lists, Vectors. And since I understood what I was doing in Perl, it was so much easier to catch on with C++.

    Perl taught me C++. Who would have thought?
  • by systems ( 764012 ) on Tuesday January 17, 2006 @02:53AM (#14488591)
    The problem I see with a language like perl6 and mant others, is that it seems they all started from the bottom.

    They add features, which already exists in some other language, only they maybe improve the interface, or add any sort of incremental improvement to it.

    My problem I see, they didn't start with a dream, which became a vision, which became a mission, which transalted to goals, and then a solid implementation.

    If you are already familiar with strategic management, you will noticed I borrowed some terms, from that field. Strategic management suggest that for an organization to succeed, it must have a clear vision (based on a dream a good cause or whatever), a mission (a more realistic translation of the vision/dream) , and finally goals and objective (implementation detail)

    So I ask, what's perl6 vision, I think perl6 started with details, this is why me and many others are not existed about it, sure it will better (maybe), but it won't be new, and probably it won't add much to the technology arena.
  • by Inoshiro ( 71693 ) on Tuesday January 17, 2006 @03:00AM (#14488618) Homepage
    My compilers professor has nothing but bad things to say about a language whose syntax is inelegant and tricky. After all, if a language is inelegant, it will be hard to read and understand, as well as hard to create a proper grammar for, or parse.

    "(Perl 5 overloaded curly braces in six different ways. If you can list four, you're doing well.)" ! Java has something like 22 levels of precedence. Most people will use the bare minimum of that, lest they tread upon a dragon's tail.

    And, one of my favourite points: "Why is the method call operator two characters (one shifted), not a single dot? "

    Perl 6 means a simpler, better parser, while keeping all the language strengths. This means it won't be such a bitch to deal with mod_perl's weird gleeps once it's Perl 6. This means smaller process overhead. This means quicker development of web applications that are cool (although I must admit, Ruby on Rails is also pretty neat looking).

    The new regex syntax alone is reason to switch!
  • Re:What is Perl 6? (Score:2, Interesting)

    by slashdotnickname ( 882178 ) on Tuesday January 17, 2006 @03:13AM (#14488662)
    Probably a pretty good sign I should get off my ass and spend some time learning the language if I don't want to become obsolete to my employer.

    I'm sure if your employer starts needing perl solutions, they'll buy you a book. It's not that hard to pick up if you come from a programming background. I once got tasked to modify a perl script, and was able to learn enough perl to get the job done within an afternoon. Been a fan of it ever since!
  • Comment removed (Score:3, Interesting)

    by account_deleted ( 4530225 ) on Tuesday January 17, 2006 @03:17AM (#14488670)
    Comment removed based on user account deletion
  • PDL (Score:5, Interesting)

    by LordMyren ( 15499 ) on Tuesday January 17, 2006 @03:45AM (#14488744) Homepage
    The article talks about some of the defining features for perl. Well, one of the defining features in my perl experience has been Perl Data Language [perl.org], pdl. PDL _is_ whipitupitude. Its a wonderful wonderful matrix library. And it comes with the best perl shell I know.

    I had to break down a equation into a sequence of linear equations. So I hacked up some PDL in like 2 hours to do that. Couldn't have been easier, even though I'd never used PDL or its perldl perl shell; I just started typing in the interactive shell until it worked as expected and until I knew what I was doing. Then I needed the results in interger, so I rounded everything down, built a permuter and sorted the permuted results for each individual segment. That took three hours, but only because I kept botching the matrix multiplication. Even with huge datasets, generating hundreds of thousands of linear equations, each spanning dozens of datapoints, permuting the linear equations, sorting them and selecting the optimal, PDL would run it all my slow arse 800mhz crusoe laptop in seconds. Matlab couldnt touch it.

    Thats the other really truly thing about PDL; the performance. If someone else would chime in and do it better justice, but my crude understanding is that it generates some kind of extremely optimized machine code on first use and runs whatever equations you've thrown at it like silk from that point on.

    Little late and a little off topic, but PDL really is just a masterpiece of perl hackability. The PDL perl shell is truly spectacular; get some symbolic integrators and differential equation solving packages in there and I wouldn't need to break open Mathematica or Matlab ever again. Ok, long way away, pdl is really just about matricies, but it is really really sweet, and its shell is good for anyone who just wants to try something out really quickly in fully interactive perl.

    That being said, I really cant wait to see where the perl6 VM is going.

    G'night!
    Myren
  • Perl 6 ~= LISP (Score:3, Interesting)

    by paulthomas ( 685756 ) on Tuesday January 17, 2006 @03:53AM (#14488768) Journal
    The article mentions blocks being closures and the fact that Perl 6 -- much like the new regex system -- is itself really a programmable grammar. It sounds like we now have real macros.

    The question is: is Perl becoming a LISP implementation?
  • by Engineer Chris ( 891425 ) on Tuesday January 17, 2006 @04:16AM (#14488822)
    And, one of my favourite points: "Why is the method call operator two characters (one shifted), not a single dot? "
    Because concatenation was already a single dot before method calls were introduced (in perl5).
  • by AuMatar ( 183847 ) on Tuesday January 17, 2006 @04:20AM (#14488831)
    Ignore the analogies, OOP has nothing to do with obkects at its core. OOP is basicly encapsulation and interfaces. You design your program so that its broken into parts. Each part handles one bit of functionality- networking, or database communication or the like. Each part is self contained, no 2 parts should know how the other part is coded- they only communicate with each other through a set of functions. These functions are called an interface. The functionality of each part is said to be encapsulated, because the actual design of the code is not known to the outside world.

    In C, you do this with functions in a .h file and call it a library or a module. Sometimes you use a struct to pass around data. A great example is the stdio library- you have a bunch of library functions to do IO. You don't know how those are implemented. ANd since you can have open IO on more than 1 file at a time, you need a bit of data to hold the state of an IO. Thats why you pass back and forth FILE* parameters.

    In C++, you put the data and the functions together in one package and call it a class. Think of a class as a C struct with a bunch of function pointers in it. So instead of calling myfunction(mystruct) you call myclass.myfunction(). Its conceptually the same (in fact, the machine code is almost identical).

    By now you should be thinking "damn, that sounds like what I do in C already". It is. Good C programmers did OOP before OOP was a buzzword. languages like C and Java just add some syntactic sugar like inheretance (one of the most abused language features ever, especially in Java) and autoatic constructiors and destructors into the mix.
  • by Colonel Panic ( 15235 ) on Tuesday January 17, 2006 @04:47AM (#14488921)
    Ok, Perl6 does indeed look cool. Lots of interesting things there. Sure, you can apparently write Perl6 code today and run it on PUGS (a Haskell implementation of Perl 6; that's gotta be speedy, eh?). But as is mentioned in the article, Perl6 was announced at OSCON 2000; that's 5.5 years ago. It's now become the posterchild for vaporware in the open source world, hence this article to keep the faithful hopeful (and to keep'em from sneaking off to Ruby, Python or even Io). Really, it just looks like the purpose of the article is to say "yes, we're still here working on Perl 6. We're working hard, we really are. Please, don't lose hope. This is hard work. It'll be here one day and it'll be great", while a lot of Perl folks who yearned for something better have already moved on to Ruby or Python.

    I really hope that Perl 6 arrives one day. I'm pretty deep into using Ruby these days having left Perl 5 behind long ago (the part of the article about what's wrong with Perl 5 was really superfluous; maybe it was intended to convince the remainingn Perl folks who are happy with 5 to check out 6), but I'll give Perl 6 a look when it arrives. The grammar support alone looks pretty awesome; it'd be great to have a viable lex/yacc alternative. In the meantime I want to learn some languages that have a bit more immediate promise like Io [iolanguage.com]. It seems that maybe the plans for Perl 6 were just too ambitious. Yes, it's great to start with a clean slate and try to revolutionize, but often it's evolution that wins out.
  • Some much better... (Score:3, Interesting)

    by AVee ( 557523 ) <slashdot&avee,org> on Tuesday January 17, 2006 @05:36AM (#14489036) Homepage
    ...it's more consistent and easier to use than Perl 5

    Some thing are just so easy there's no pride in it. Now make something more wich is harder to read then Perl 5 and you've achieved something. It may be better, but is it good?
  • by Scarblac ( 122480 ) <slashdot@gerlich.nl> on Tuesday January 17, 2006 @06:01AM (#14489107) Homepage

    The mind-bending thing of Haskell's list comprehension is mostly that they're evaluated lazily, and can be of infinite length. A famous examples is of course the implementation of the Fibonacci function in Haskell as an infinite list:

    fibo = 1 : 1 : zipWith (+) fibo (tail fibo)

    Python's list comprehensions are rather neat, but they lack those features, so they don't come near Haskell's level of mindbendingness. They're mostly a cool shorthand for writing down lists that would have been ugly with map() and filter(). I wish the dict comprehension [python.org] PEP had made it...

    (I'm a Python fan, but nowadays I program Perl for a living and play with the book Practical Common Lisp [gigamonkeys.com] in my spare time... give Lisp a try!)

  • by Anonymous Coward on Tuesday January 17, 2006 @06:18AM (#14489136)
    I've still never understood the popularity of perl: it's a horrible looking and very obfuscated language which sits in the middle of the programming arena, i.e. where it servers no purpose. If you want fast complicated code, use C; if you want a script use ksh, awk or python - faster and cleaner.

    Then, we have CPAN - the mangled mess of packages which makes fedora's rpm system look well managed.

    And the worst bit: the perl zealots who insist of using this language for everything, even when they have to jump through hoops to get it working.

    If perl was wiped of the face of the universe tomorrow, I for one would cheer!
  • by Anonymous Coward on Tuesday January 17, 2006 @06:26AM (#14489146)
    That's one of the problems with inheritance. It's entirely possible to override an innocent looking method, and in doing so break the contract of an apparently unrelated method in a different class. It's extremely difficult to debug when it does occur, and the probability of it occuring increases with the complexity of the system. It becomes a real problem when lots of programmers work on the same project, especially if some of them don't understand the whole codebase, aren't very experienced, or are just plain idiots.

    It is possible to work around this by using disciplined inheritance or, better still, by not using implementation inheritance at all, and going for interface inheritance instead. You still get polymorphism, and you still get code reuse (you just need to design the system differently), but you don't get the hidden problems, and the resulting system will be far more robust.

    By the way, COM actually uses a similar system. It's based purely on the idea of interfaces. Each COM object can implement one or more interfaces, but can not inherit behaviour from another COM object. Internally, you can use implementation inheritance as much as you like, but from the outside there is no inheritance. You can implement the behaviour of one object in another by encapsulating that object and forwarding method calls, which is externally the same as implementation inheritance, but is more flexible (since you can "inherit" from any object that implements a specified interface without problems), and way more robust.

    Hmm... That course I did on component-based software engineering back at university made much more of an impact on me than I thought.
  • by BlueYoshi ( 670106 ) on Tuesday January 17, 2006 @06:33AM (#14489162)

    I was thinkink like you till I was hired in a company that use real OO technique.

    And I learn the beauty of OO and the very nice way to solve problems by using Factory, Prototype, Facade, Visitor Patterns. I can tell you that before I was writing Object but not thinking 'object' and that is very different.

    I agree its possible to code in Assembly using OO technique but it is really not natural and can be really tricky to do .

  • by I Like Pudding ( 323363 ) on Tuesday January 17, 2006 @06:45AM (#14489212)
    Well then how about
    print map {"(@$_)"} @$a; #---> (1 2)(3 4)(5)(6 7 8)
    instead?

    TIMTOWTDI, bitch!

    Seriously, though, nested data structures and the deferencing syntax is the single worst part of perl. I'm not surprised it made you break out into hives. Your main problem, though, is that you keep thinking a list is an array. It isn't. Parens build lists, and arrays are primarily built from lists. Also: learn to use google. I ran into this same problem when I was first starting out and took a few hours to nail down some docs and get familiar with it. The syntax is ugly and annoying, but not overly difficult (assuming you already understand references).
  • by Anonymous Coward on Tuesday January 17, 2006 @06:53AM (#14489236)
    I like the use of "." for concatenation

    "+" as an operator sugguests that the order of the items being operated on has no effect on the answer...

    eg. 2 + 3 == 3 + 2

    but
    "two" + "three" != "three" + "two"

  • Perl6's direction (Score:2, Interesting)

    by I Like Pudding ( 323363 ) on Tuesday January 17, 2006 @07:23AM (#14489324)
    From the examples I've seen, I'm worried. Perl5 already has too much syntax for my liking (see the subthread on nested refs. yuck), and Perl6 seems to be going much, much furthur in that direction. Will it be powerful? You bet! The problem is that Larry thinks power is the sort of subtle change of inflection that can alter your meaning from "Greetings!" to "Greetings, shithead!", but only when the moon is in the third house. I'll hold off my judgement until it ships; I certainly owe Larry that much for how much use I get out of 5. In the meantime, though, I will be using Ruby as much as I can and wondering how anything else can be more fun to write in.
  • Re:Perl 6 is (Score:3, Interesting)

    by TheP0et ( 862727 ) on Tuesday January 17, 2006 @07:27AM (#14489339)

    Not just another virtual machine nobody needs. Perl6 is also a consequent implentation of language development paradigms. Java started some of it with its so called "platform independent" VM. Microsoft jumped on that train with DotNet and its intermediate language for the CRL. Perl6 bundles those ideas together, gets rid of hierarchy constraints inherited from the old OO drafts, and adds complete costumizability to syntax and grammar while trying to keep the number of built-in functions as small as possible.

    No other language does make it so easy by now to adapt the language itself to the needs of the special environment. You could for example write a module that forces strict inheritance to all of your objects, or implicitly puts all variables and values into a protected memory range, or dump your current program state onto a disk, everything within the blink of an eye.

    Other implementations of introspection, like Java's Reflection API, provide the needed self-awareness of the code and the means for dynamic object handling up to some point, but that point reached, things tend to get rather ugly. Perl5 provided some "dirty hacks" for a part of that, but couldn't cover everything without breaking compatibility and, most of all, performance.

    Still Perl6 won't be the sole answer to every question - as allways TMTOWTDI. But it's certainly interesting enough to keep an eye on it.

  • Perl 6 = COBOL 9x (Score:3, Interesting)

    by scottsk ( 781208 ) on Tuesday January 17, 2006 @08:40AM (#14489526) Homepage
    Perl 6 reminds me of the super-revamped, object-oriented COBOL that came out in the 90s -- by the time this perfect language was created (and it was a decent upgrade, although the OO stuff was so verbose it wasn't funny), COBOL 85 had such a huge installed base that COBOL 9x was irrelevant. The amount of code written to the COBOL 85 standard was immense, and most new development had moved on to other languages. Maybe Perl 6 can escape the Fortran 9x and COBOL 9x trap of being really great languages about a decade too late. The biggest hurdle Perl 6 is going to face is its own installed base. It will have to be 100% compatible with Perl 5 to get people with a code base of Perl 5 code to even think about using it. Plus, it needs to have a compelling story to tell. I was excited about Perl 6 five or six years ago.
  • Just one question (Score:3, Interesting)

    by Dasher42 ( 514179 ) on Tuesday January 17, 2006 @01:25PM (#14491530)
    Will Perl 6 finally end the sheer madness of allowing a function to use loop control statements like next and last to meddle with the loops in their calling functions?

    Some of us have predecessor's code to use and maintain that do the darnedest things, you know. A bit of protection from the madness of others, that's all I'm asking for.
  • Re:10 Years Overdue (Score:3, Interesting)

    by Sentry21 ( 8183 ) on Tuesday January 17, 2006 @02:22PM (#14492124) Journal
    His post makes reference to how Perl 5 was released in 1994, and people were expecting Perl 6 to obsolete everything 'overnight'. 'Perl 5 is great, welcome to 1994, but Perl 6 is going to be out soon, and in order to stay up to date in this fast-paced world of technology, you'll need to learn Perl 6 before you're done learning Perl 5' sort of thing.

    The 10 years the OP is referring to is the 10 (now 11, nearing 12) years since the release of Perl 5, without any major updates to the language (other than a sane versioning scheme).

"God is a comedian playing to an audience too afraid to laugh." - Voltaire

Working...