Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Schrodinger

by larsen (Parson)
on Sep 25, 2000 at 17:10 UTC ( [id://33906]=perlmeditation: print w/replies, xml ) Need Help??

Inspired to a recent episode

The apprentice went to Zen Master and cried: "My program does not work! I read and re-read my source code, I tried to use debugger, I added a lot of debugging messages!"

The Zen Master spoke softly: "Observer disturbs phenomenon".
Then, he turned off the monitor, run the apprentice's program and turned on the monitor. The result was correct.

The apprentice gained enlightenment.

larsen

Replies are listed 'Best First'.
RE: Schrodinger
by Adam (Vicar) on Sep 26, 2000 at 01:28 UTC
    This is so very true. I had a problem once where I wrote a huge script and embedded lots of code like this:
    print DEBUGOUT "blah blah debug message blah" if DEBUGGING;
    And the code worked great in debug mode. But for the real thing I didn't want this huge debug log being generated so I flipped the bit, so to speak, and the thing stopped working. I spent a day trying to figure out why it only worked in debug mode... hehe the line at fault looked a little like this:
    print DEBUGOUT "key=$a, value=$b\n" while( ($a, $b) = each %hash and D +EBUGGING );
    The problem? When I'm debugging the code the each iterator was able to go all the way through, but when I'm not debugging, the each iterator gets run once and then stops. When I need it later, I'm off by one. Ooops. By the way, while I could have fixed this by swaping the order inside the while predicate, I opted to follow a fellow Monk's advice and used Data::Dumper
RE: Schrodinger
by japhy (Canon) on Sep 25, 2000 at 17:13 UTC
    Ah, the Schroedinger Perl program. It is in a state of functionality until you run it. ;)

    $_="goto+F.print+chop;\n=yhpaj";F1:eval
      ... or the perhaps output is correct until you look at it?
(redmist) RE: Schrodinger
by redmist (Deacon) on Sep 25, 2000 at 21:47 UTC
RE: Schrödinger
by wombat (Curate) on Sep 26, 2000 at 12:18 UTC
    See, true Schröedinger code would unlock all sorts of fuzzy logic. You could have 1, 0, and unknown. Effectivly building the trinary computer (Yes, from that RPG). The trick is, to be able to reproduce Schröedinger bugs whenever we feel like it. This would be difficult as we would have to code without observing what we're typing, or as a perhaps better solution, place our code in a box after finishing it. Also. does thinking about a certain section of code count as observing it, or do we deal with an idealized version of the code in our minds that is unlinked from the physical segment of code? Does linking this abstract mental segment of code allow for the creation of Schröedinger code? Does that change the answer to the first question? I sense there's something very big here, if only we could grasp it further.

    [sane|insane] ~W
      I don't know anything about role playing games, but trinary computers have existed since 1958. The first was built by Nikolay Brusentsov, a Russian. Here's a link to a little bio about him.

      You can also use google to do a search for Russian trinary computers.

      --Chris

      e-mail jcwren

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found