http://www.perlmonks.org?node_id=719389


in reply to Re^3: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands

For a start, you'd have to modify that with s[was][will be].
Indeed, that is precisely the Perl 6 solution to the problem: time travel. Context in Perl 6 is not determined at compile time or even at evaluation time, but rather at binding time, which is even later than that. Think of it as JIT context.

'Course, Perl 6 also defines what it means to have a list in scalar context, and unlike Perl 5 defines it to not throw away information. You never get return-the-last-value semantics unless you ask for it specifically via subscripting. A list in scalar context just turns into an array object. An array in scalar context also just remains an array object rather than presuming that scalar context means numeric context. This lazy kind of time travel means the array can behave correctly and consistently in numeric context, boolean context, string context, or even, horrors, referential context.

Unfortunately, you also need time travel to have a finished Perl 6. Fortunately it's the kind of time travel that can be implemented by waiting, as long as someone else isn't... :)

  • Comment on Re^4: If you believe in Lists in Scalar Context, Clap your Hands

Replies are listed 'Best First'.
Re^5: If you believe in Lists in Scalar Context, Clap your Hands
by BrowserUk (Patriarch) on Oct 24, 2008 at 20:02 UTC
    Think of it as JIT context.

    Thinking about that brought an old song to mind :)

    Abstraction (analogy) underlies all learning more abstract than the "if you put your hand in the fire, you'll get burned" kind. One good abstraction can do more to promote understanding than all the details in extremis ever can.

    By modern standards, the Rutherford model is very inaccurate, though far superior to the the Plum Pudding model that preceded it. None the less, the Rutherford model was sufficient to educate a whole generation of new physicists to the point where they could visualise beyond it, and so replace it.

    Fortunately it's the kind of time travel that can be implemented by waiting, as long as someone else isn't... :)

    And that made me think of a poem (strictly a prayer, but I omit the first word):

    Grant me the serenity to accept the things I cannot change, the courage to change the things that I can, and the wisdom to know the difference.

    Whilst looking for the exact wording of that, I came across this. The one response is rather interesting, and thought provoking.

    There are several thousands years behind the philosophical debate that rages barely shuttered under the surface of that verse: What is the difference between 'knowledge' and 'wisdom'?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      "What is the difference between 'knowledge' and 'wisdom'?"

      Perhaps experience.

        Perhaps experience.

        Evel Knievel probably knew more about jumping motorcycles than anyone else alive. Knowledge gained through copious experience. But was it wise to keep on doing it?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        Information is not Knowledge. Knowledge is not Wisdom. Wisdom is not Truth. Truth is not Beauty. Beauty is not Love. Love is not Music. Music is the best.