Slashdot Mirror


Exegesis 3 Released (Perl 6 Examples)

chromatic writes "On the heels of Larry's most recent revelation, the mad scientist of Perl (Damian Conway) has followed up with Exegesis 3. His article gives working Perl 6 code examples of Larry's design decisions." Lots of good stuff in here.

9 of 85 comments (clear)

  1. "working" examples by Sneakums · · Score: 3, Funny
    His article gives working Perl 6 code examples...

    How can these be working examples when Perl 6 does not even exist yet?

  2. Some thoughts by reynaert · · Score: 4, Insightful

    Some of this new stuff seems to be seriously blurring the difference between language and library.

    Of course it's cool to write something like @costs, but why must be an operator? It seems to me it would work just as well as an ordinary procedure.

    I'm wondering if they are thinking about constructs to define new syntax at runtime. In Scheme for example most of the syntactic forms are defined in the library using define-syntax .

    1. Re:Some thoughts by scrytch · · Score: 5, Insightful

      Some of this new stuff seems to be seriously blurring the difference between language and library

      Bingo. Perl has very malleable syntax, which is perhaps not as flexible as, say, SML, but still has had a philosophy of letting you rewrite good chunks of perl in perl. Perl6 is just adding to the potential confusion, letting you write code as twisted and evil as you want to. Besides, if you tend to write mathematical apps commonly ... well, you might not write them in perl, but you probably do at least " on an easy key (I had to copy and paste it myself). " does not need to be an operator. It just can be.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    2. Re:Some thoughts by scrytch · · Score: 3, Insightful

      Bah, piece of crap turned my sigma characters into something else entirely. My guess is unicode input box, non-unicode form processing... I think the mainframe world is chuckling at us now, they dealt with EBCDIC dialect conversion issues on a daily basis decades ago...

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  3. wow, perl meets apl by scrytch · · Score: 4, Interesting

    I do love the hell out of perl, but I sure hope I can "use English 'operators';" for things like the hyper-operators. 'course, maybe 'use English' is deprecated ... can't wait for 'use Chinese', imagine what perl would look like then...

    I would much rather see "@diffs = @set1 ^- @set2" expressed as a list comprehension, say @diffs = (each $x - $y suchthat $x in @set1, $y in @set2); (assuming I have said "english operators" on, otherwise I would imagine at least the 'suchthat' operator would be some punctuation char). It's a bit contrived for something as simple as subtracting every member of a couple lists, but list comprehension is beautiful stuff when combined with lazy evaluation in languages like Haskell.

    Oh, and Perl6 is going to have an 'in' operator, right?

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
    1. Re:wow, perl meets apl by Dr.+Awktagon · · Score: 3, Insightful

      I'd like to see something like this:

      @diffs = map { $1 - $2 } @list1, @list2
      That makes sense to me at first glance..or maybe better something like this:
      @diffs = map { $_[0] - $_[1] } @list1, @list2
      which would be like taking one element from each list and passing them to the "subroutine" in the block. Anything would make more sense than ^- !
  4. Admittedly the syntax is getting out there by Ars-Fartsica · · Score: 3
    Hopefully you won't be marked as a troll, because I think in a way you are correct. Larry is recreating the language to be even more palatable to perl gurus but I think more hostile to newbies.

    On the other hand, if you can obscure complex operations into short syntactic sequences, you can keep the programmer from shooting himself in the foot. Look at Java - its syntax is probably as plain and up-front as you can get, but the need to spell most things out explicitly means most programmers spell them out incorrectly. Therein lies the magic of some syntactic freakshows like regular expressions - imagine programmers defining their own NDFAs? I understand this is not a great example as other languages support perl-like regexes, but maybe you get my drift.

    I think the conlcusion is that perl will be like Haskell and Lisp in a way (not a functional language per se) in that programming in perl will simply require a different approach and strategy. You'll have to think in perl in order to properly program in perl. It simply won't be for translating C into an interpreted environment or sh into a portable syntax, it'll be its own paradigm.

  5. Unfortunately you will probably get your wish by Ars-Fartsica · · Score: 3, Interesting

    I believe there is extensive remodelling called for by the current Perl6 gameplan, although I think this will further distance Perl 6 from Perl 5 programmers, and most likely some of them will simply move on to other languages which don't seem like such moving targets (although with Python claiming a signficant rewrite in the future, there may not be much of a safe harbor outside of yuck Java).

  6. Perl6 multiway comparison requires telepathy by dha · · Score: 3, Insightful
    On the one hand, Exegesis 3 tells us that in Perl 6,
    100 < -s $filepath <= 1e6
    is essentially equivalent to:
    (100 < -s $filepath) && (-s $filepath <= 1e6)
    except that the `-s $filepath' only gets evaluated once. We're supposed to be Wow! Neat! about that.

    On the other hand, we are also told:

    Did you notice that cunning $a == $b != NaN test in operator:EQ? This lovely Perl 6 idiom solves the problem of numerical comparisons between non-numeric strings.
    which may be cunning, except of course with wow neat multiway comparisons it is equivalent to ($a == $b) && ($b != NaN), which doesn't do the advertised job.

    Finally, lest we might suspect operators like < and <= are treated differently from == and != for purposes of this `feature', we are told:

    binary <, >, lt, gt, ==, !=, etc. become chainable

    Predict the ultimate (though probably not imminent) demise of multiway comparisons in Perl 6.