http://qs321.pair.com?node_id=80774


in reply to Exegesis 2 - Perl 6

My comments on the article:
  • typed lexicals are great. they will reduce memory and increase speed. And allow Perl to even more powerfully bridge the gap between shell and C that perl was designed to.
  • Damian sayeth
    like most other global punctuation variables, $/ has been banished from Perl 6
    I guess that means bye-bye to a lot of obfuscated Perl code. The globals really never affect most people's lives anway, except $|
  • Damian sayeth
    (in Perl 6 -> is spelled .)
    Hmm, we have tons of code using ->. Also, the arrow stands out better. Whats purpose of this change? I don't like it.
  • Damian sayeth
    The call to $node.Found would normally be a method call (in Perl 6 -> is spelled .). But since $node is just a regular unblessed hash, there is no Found method to call. So Perl treats the request as a property query instead and returns (an alias to) the corresponding property.
    This is an interesting fall-through property. But does it mean that execution time increases because it starts making run-time checks for methods before doing a hash lookup?
  • Damian sayeth
    But then the serpent of OO entered the garden, and offered Perlkind the bitter fruit of subroutine and method calls: print $subref->(); print $objref->method(); Now the leading $ no longer indicated the type of value returned. And in beginners' Perl classes across the land there arose a great wailing and a gnashing of teeth.
    Wow, for all my efforts to detect inconsistencies in Perl, it never occurred to me that the dollar sign should by arguments of context imply a scalar return value. It was just so natural to use I never thought of how it broke that rule.

    I dont believe Damian mentioned how method calls would imply the type of their return values did he? Nothing like

    @objref->method()
    is on the horizon is it?
  • Replies are listed 'Best First'.
    Re (tilly) 2: Exegesis 2 - Perl 6
    by tilly (Archbishop) on May 16, 2001 at 05:55 UTC
      In order.
      1. Optional typing systems are a nice idea, but I doubt they will be used much. For instance if you properly declare things in Common Lisp, it is supposed to be as fast as C. But most people don't do that, and those who do occasionally get good foot-shootage out of it. Besides which, the performance gains will probably not really materialize for a couple of iterations.
      2. The global variables were ridiculous. The only one I would miss is $!. I am used to typing that...
      3. Changing the arrow syntax brings Perl in line with the syntax used by virtually all other languages. And backwards compatibility is not an issue since Perl 5 code will run through the translator which supports the old syntax.
      4. The fallback goes the other way. You are making a method lookup and it falls back to a hash lookup when no such method is found.
      5. Again you have what Damian said exactly backwards. Perl will go from methods not saying what you get but everything else saying what you will get to having nothing say what you will get. So I suspect that if something like @object.method() is on the horizon it will be something like map {$_->method()} @object is today...

        1) The real win advertised (to my reading, which was a bit between the lines) was that something of type "int" would take up less space, so I doubt that will take interations to get working. Speed improvements may also eventually come (or not).

        3) But how do you concatenate strings in Perl 6?

                - tye (but my friends call me "Tye")
          First you are right about the real reading of the win. But I think that their first implementation should just work without much worrying about optional optimizations at all. Attempts to have multiple things that could be scalars should be a second pass. Attempts to become smart about it (and not promote those ints to full scalars at the first moment) might take a while.

          As for the third point, Larry will have to decide on a string concatenation operation other than the current. Personally I can learn a new concatenation operation fairly easily. As long as he doesn't pick +, I won't really care what he does there...

    Re: Re: Exegesis 2 - Perl 6
    by premchai21 (Curate) on May 16, 2001 at 05:39 UTC
      My responses to each item follow:
      • Typed lexicals are okay, as long as there continue to be untyped lexicals also.
      • What? $/ is gone? Darn. I really liked that variable.
      • /me likes ->. I like all the operators the way they are, thank you.
      • Ow! Provide an option to turn the hash fall-through off at least.
      • @objref->method()? I certainly hope not.
        What? $/ is gone? Darn. I really liked that variable.

        It's gone as a global variable. It's now a property of each individual filehandle.

        Which makes far more sense.

        --
        <http://www.dave.org.uk>

        "Perl makes the fun jobs fun
        and the boring jobs bearable" - me