Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by BrowserUk (Pope)
on Oct 24, 2008 at 12:00 UTC ( #719329=note: print w/ replies, xml ) Need Help??


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

it returns the value of the last expression, evaluated in the context the function was called in

For a start, you'd have to modify that with s[was][will be].

Like I say, the alternatives suck! Bigtime!


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.


Comment on Re^3: If you believe in Lists in Scalar Context, Clap your Hands
Download Code
Re^4: If you believe in Lists in Scalar Context, Clap your Hands
by Anonymous Monk on Oct 24, 2008 at 16:43 UTC
    Your functions return now when they are called in the future? My functions only return after they have been called. That does suck in comparison.
Re^4: If you believe in Lists in Scalar Context, Clap your Hands
by TimToady (Parson) on Oct 24, 2008 at 16:56 UTC
    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... :)

      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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-12-28 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls