Slashdot Mirror


Exegesis 2: Damian Conway On Perl6

sumengen writes: "Damian's writing a series of articles parallel to Larry's Apocalypses. These 'Exegesis' articles will show full perl6 programs, with commentary exlaining the new features. The first Exegesis (numbered 2, to keep in sync with Larry) shows a perl6 version of a binary tree program from the Perl Cookbook. Get excited to see things like:
my int ($pre, $in, $post) are constant = (0..2);"

18 of 125 comments (clear)

  1. Re:Perl ? Mmmmm......... by jCaT · · Score: 3

    I had a really nice response to this that would have been extremely helpful, but the guys at slashdot seem to think perl code is random characters:

    Lameness filter encountered. Post aborted.

    Reason: Junk character post.

    Kind of funny, since it's all written in perl. Kudos, rob- you've managed to stifle any discussion about perl code. :)

  2. Maby just *to* flexible ? by AftanGustur · · Score: 3

    How about:
    $*ARGS is chomped;

    Maby it's just me, but I fear that setting properties to variables that affect how fuctions work on them, will greatly decrease the quality of code, available.

    Let's just face it, not everybody has even heard of Dijkstra, let alone know how to write 'proofable' programs.
    --
    echo '[q]sa[ln0=aln80~Psnlbx]16isb15CB32EF3AF9C0E5D7272 C3AF4F2snlbxq'|dc

    --
    echo '[q]sa[ln0=aln80~Psnlbx]16isb572CCB9AE9DB03273snlbxq' |dc
    1. Re:Maby just *to* flexible ? by hillct · · Score: 3

      The thing is, it's like those MasterCard Commencials that are currently runnning (in the US) where the slogan is "Credit Management tools for the slightly smarter consumer"

      Well, the fact is, the slightly smarter consumer can manage their credit wothout being provided with credit management tools.

      Perl is extremely flexible and powerful. Good perl programmers can manage their code in such a way as to make it readable in 6 months and 9 months and 12 months. It's a matter of dicipline. Code management should not have to be built into the language. We're not talking about COBOL here, after all. If you need code and structure management, lay it out nicely, get a good editor, etc. Perl is intended to provide results and fill a need, which it does vary well As Larry says "It makes the easy jobs easy and the hard jobs possible". I fully agree. Without Perl, I'd me doing admin work in awk and sed, cuz C would just be a waste of time in that context.

      Program and code management should be on the back of the programmer not the interpreter/compiler, regardless of what language you're using. Flexibility is power and power is good. the trick is to find disciplined programmers who can manage it without special tools provided to them as if they weren't expected to be capable in their own right.

      --CTH

      --

      --

      --Got Lists? | Top 95 Star Wars Line
  3. Re:Perl ? Mmmmm......... by malkavian · · Score: 4

    Urrr.. I tend to use Perl a lot.
    Ya know, it's quite easy to pick up (I got up and running in an afternoon on the basics).
    The prefixed identifier is pretty useful as a memory aid, so that you are ALWAYS aware of what type you're dealing with (scalar, array, hash, sub, or typeglob).
    To learn what these are, you read one page in a book, and all is clear. Now, how difficult is that??
    If you're having trouble extracting values out of variables, then I think you have a weird view of 'difficult'. Pulling a value out of a deep struct in C can be difficult, but using $_ being difficult? Bah.
    Still, if you don't like it, fine. Your choice. But, please don't keep saying it's so difficult.
    I taught my Girlfriend to use Perl in a day (at the basics), and she's never learned a programming language in her life prior to this. She's now sailing away in it happily.

    Cheers,

    Malk

  4. ode to a small perl of green putty... by ethereal · · Score: 3

    Perl may look confusing, but there's nothing like having to work in VB for a week to make you miss the raw power Perl provides.

    Some of these language changes disturb me too, but I trust Larry to ultimately make it fairly simple to transition from perl5-think to perl6-think. The transition will break a few things but it sounds like it will increase the power of the language by about as much as perl4 to perl5 did.

    Caution: contents may be quarrelsome and meticulous!

    --

    Your right to not believe: Americans United for Separation of Church and

  5. Shades of PL/I by geophile · · Score: 4
    25 years ago, I spent many hours debugging a PL/I program to discover that some code I inherited relied on arcane initialization rules and got it wrong. How nice to know that untold generations of programmers will now have the same experience thanks to constructs like "my int ($pre, $in, $post) are constant = (0..2);" I was never a Perl fan and I'm even less of one now. But out of curiosity, what possible justification is there for such a construct?

    I was also happy to see Basic's "dim" recycled.

    Really guys, haven't we learned anything since oh, I don't know, 1965?

  6. PERL: PERL is an Ebonics-Related Language (?) by Jester99 · · Score: 5

    Now in Perl 6, one can have such syntax as: my int ($pre, $in, $post) is constant = (0..2);
    and: $ARGS is prompts("Search? ");

    With the advent of this new "is" construction and the use of passive voice in the code, I think that the following should also be added:

    • A be operator,
    • a being modifier, and
    • the gerundative form (-ing) of any keyword should be allowed.

    This would allow for such conventions as:

    $*ARGS be chomping;
    "LibCGI.pl" is being required;

    (or if one wants to be smart:)
    recognize $foo!;

    Just a thought.

  7. Re:unusual... by James+Lanfear · · Score: 3

    Try comp.lang.ada. It's swarming with Ada fans, many of whom would be happy to explain why they love the language so. Ada Home and AdaPower both have quite a bit of information and evangelism (the former is a bit of a 'classic', though).

  8. What I want to know is by Jailbrekr · · Score: 3

    Does Perl still support GOTO?

    God, I love that command.

    --
    Feed the need: Digitaladdiction.net
  9. The language life cycle by Animats · · Score: 4
    There's a life cycle of languages that start out without a serious type system. It goes as follows.
    • "We don't need all those declarations. We'll have nice, concise programs"
    • "Without any declarations, nobody can keep their variables straight. So we'll have a few declarations, but not like those complicated languages".
    • "People are writing big programs in this language, and they need types and objects. So we'll put them in".
    • "Now that we have types and objects, people expect all the features that go with them. So we'll add them".
    • "The declaration syntax is a mess. It's unreadable, hard to parse, and programmers have a hard time using it right. How did we get into this hole?"
    • "This language is too complicated. Let's develop a simpler language."

    Wash, rinse, repeat.

    C went through this evolution, taking about 25 years to do so. Originally, everything in C was basically a 16-bit int. Structs were just a set of offsets. There was no type-checking; any struct field could be used with any pointer. Then came K&R C, which added a type system but made the syntax context-dependent, because the original language hadn't contemplated user-defined types. ANSI C made the type system consistent. C++ added objects. ISO C++ added templates, collections, and lots of other stuff. Now the language and its manuals are huge.

    LISP also went through this cycle, again taking about 20-25 years to go from LISP 1.5 to Common LISP. So did FORTRAN and BASIC. Perl is now well along into this cycle.

    If you put in the type system first, as Java, Python, Pascal, Ada, and Smalltalk did, the end result is cleaner, but the language gets an initial reputation of being complicated. Perl, though, has now grown to be more complex than any of those languages, so it's on the downslope of the cycle.

  10. Want to go see Damien ? by jasontheking · · Score: 3

    For those of you in Victoria, Australia, You can go see Damien Conway talk about some of the things he is doing for perl at the moment.

    More details are at http://programmers.luv.asn.au/

  11. Hitchhiker's guide to Perl by Siener · · Score: 5

    There is a theory that if anyone ever discovers exactly what Perl is for and why it is here, it will immediately disappear and be replaced by something even more bizarrely inexplicable.

    There is another theory which states that this has already happened...

    There is yet a third theory which states that both the first two theories were concocted by a wily editor of the Camel Book in order to increase the universal level of uncertainty and paranoia, and so boost sales of the book.

  12. Randal Schwartz, are you out there? by VSarkiss · · Score: 3
    Merlyn, HELP!

    This is so confusing. Just the sight of @_[0] to mean a scalar, the second argument to a sub, makes me feel dizzy, and the little hairs on the back of my neck stand up. Please, find Damian and Larry and wake them up somehow. Cold water, dope slap, whatever it takes!

    ...

    Whew. I hate those early-morning nightmares. Both Larry Wall and Damian Conway were in this dream, wearing dark suits and Ray-Bans, and, and....

  13. Re:Perl ? Mmmmm......... by Golias · · Score: 4
    As I read down through the nested comments, and see yet another compare-and-contrast between Perl and C++, I feel compelled to point something out.

    Perl is an interpreted language that lets you quickly hack big jobs with small effort.

    C++ is a compiled, object-based language, designed for projects that require the advantages of the OO model and the speed of pre-compiled binary code.

    A good all-purpose programmer should learn both. Asking which is better is like asking if a Mack truck is better than a Lotus Esprit Turbo... the answer depends largely on what you want to do with it.

    --

    Information wants to be anthropomorphized.

  14. Re:Perl ? Mmmmm......... by perlyking · · Score: 3

    The example looks fine to me, perhaps you're confusing your inability to understand the language with whether or not its a good programming language.
    If you like C++ or BASIC then use them instead, I really believe people should choose the language that fits their way of thinking, I enjoy using perl and find it makes sense, you may prefer C++ - that doesnt make either of them better or worse than the other.

    --
    no sig.
  15. applescriptish by KevinMS · · Score: 3


    First of all, I really wish they'd put in a println function, I really hate typing "\n"

    but then again

    sub println{ print "$_[0]\n";}
    print "hello";

    in other thoughts, the 'is' in

    %node{VALUE} = $val is Found(0);

    kinda scares me because it reminds me of applescript. I dont remember applescript, but I've done some sizeable things in it, and its so close to a natural language that you get confused and start programming in english. Its good that spoken language and programming languages look so different, otherwise I'd accidentally start speaking in code.

    --
    Sneakemail is to spam filters what an ounce of prevention is to a pound of cure.
  16. Re:Contexts... by OpCode42 · · Score: 3

    my head($brain_cells) are hurting = (newSyntax);
    butMust -> learntodoit() or die "Knowing I have failed.\n";

  17. The real strength of Perl by Dana_D · · Score: 5

    The real strength of Perl lay not in its technical construct, or its syntax, or even in the vast set of modules and libraries available to it. The truest strength of Perl is its culture. Larry Wall, from very early on, has tried to foster a real, positive community.

    Perl6 is yet another cultural extension to Perl5. The RFC process was very messy, disorganized, and perhaps a little out-of-control. Indeed, as Larry said, he spent several months mentally thrashing as he tried to grok all of the RFC's. But that is the way he wanted it. The RFC process was a picture of a real-life war-room or think-tank.

    The end result will be very exciting, I believe. The Perl6 documents, to date, have capitalized on cultural strengths of the Perl community.

    Truly, Perl6 is built on the most important resource available to Larry: the huge diversity of Perl programmers all over the world. That diversity has made Perl5 a great, legendary language. I think it will make Perl6 even better. As Perl advocates, I think our best effort is in being inclusive, rather than exclusive, in our thinking.