Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by TimToady (Parson)
on Oct 24, 2008 at 16:56 UTC ( #719389=note: print w/ replies, xml ) Need Help??


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
Re^5: If you believe in Lists in Scalar Context, Clap your Hands
by BrowserUk (Pope) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://719389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2014-10-22 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (119 votes), past polls