Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Doing "it" only once

by Limbic~Region (Chancellor)
on Sep 21, 2005 at 15:31 UTC ( [id://493845]=note: print w/replies, xml ) Need Help??


in reply to Re: Doing "it" only once
in thread Doing "it" only once

jdporter,
The first part of your response is identical to cog's. I will refer to my response there. I am pretty sure your last comment still only works in the most trivial of cases. Consider:
  • Restarting most loops requires knowing where the previous left off
  • Having more than 1 "run this once" statements complicates things dramatically - especially if order is unknown
  • The "run this once" condition might not always be skipping to the next iteration in the loop
I am sure there are more and the point of the medidation isn't to enumerate them. Just assume for a second that the functionality existed and by some magic it didn't cost much - what would you do with it?

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Doing "it" only once
by jdporter (Paladin) on Sep 21, 2005 at 15:47 UTC

    Understood. But neither your (trivial) example motivating problem, nor your proposed solution, addresses any of those points either. So I don't quite grep why you have any issue with my/coq's answer.

    Why don't you post a real-world problem that has all of your bulleted issues above, and then post a real-world solution for that problem?

      jdporter,
      See my reply to the AM.

      Paragraph added
      What are you calling my proposed solution? I have not provided any solution. I have outlined a functionality that does not exist and asked for people to think about how they would use it if it did.

      I included the original example just so people could get an idea of what I was talking about. I wasn't hoping for people to provide solutions to specific cases but to think about what they would do if they had a built-in general purpose way of identifying code that once executed would disapear. So far, optimizing looping constructs appears to be the only application but I can't believe that's the only one.

      Cheers - L~R

        What are you calling my proposed solution?

        I was referring, however inaccurately, to "the following inelegant code".

        FWIW, lambdas are one way I typically address the need for dynamically replacing code at runtime, just as in your... "inelegant code" (for lack of a better name). In larger application contexts, object-oriented solutions are probably better, IMO.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found