I haven't done much (ok any) Perl programming for a while (several years), and just come back to it recently.

I used to wake up thinking of Perl code snippets, and now it is back again.

Sometimes I could use this to good effect, by thinking about a particular programming problem as I fell asleep. Usually, when I woke up, the corrected code would have been stored away for retrieval, as though the little elves from "The Cobbler and the Elves" had been in there overnight and fixed the code.

Mostly though the as I fell asleep didn't happen until very late (early) or I would wake up in the middle of the night with a Eureka! moment.

This seems related to the ability (also just regained) to think in Perl. As with other "spoken" languages (e.g. Spanish) which I know a bit, I find myself thinking in Perl. Sometimes this is conscious, but more interestingly is when the Perl (or Spanish) way of expressing the concept pops into the head, and this is usually when the concept is best represented in that language.

So, I write this having been awoken by the little elves telling me that they have come up with a great idea for some obfuscated Perl code that they just had to tell me about !

I'd be interested to hear other monks' thoughts on this and whether they program in their sleep.

Update: This is the obfuscated Perl mentioned above.

Replies are listed 'Best First'.
Re: Do Monks dream of Perl sheep ?
by Mission (Hermit) on May 19, 2001 at 10:33 UTC
    Brovnik, I agree with you. There have been many discussions about the 'code dreaming' both as nodes, in the CB, in my office, and other places where I meet coders. I think the reason that this 'suprises' people, is that usually we don't assume that our dreams are worthy of 'producing' solutions.

    I think this dream utility depends upon how 'tight' you are with your current project. I know it works that way for me. I problem solve in my sleep all the time. It could be code, or construction, it doesn't matter. The common factor is: "How much is this problem on my mind?"

    I've only worked with Perl for about two months now. Just yesterday I used for the first time. I read the perldoc and 'used DBI', and had it working in about an hour. I was so proud of myself... I didn't have to post a node to figure it out! :) What I soon realized is that the DBI really is about that darn SQL that I haven't touched for about 2 years (much like you're comment about not utilizing perl for quite a while.) Low and behold, I dreamt of nothing but SQL problems last night. (BTW: not a restfull sleep ;| )

    I know there are many stories about this, and I think it is worthy of discussing these 'dream solutions' on occasion. It's a different way of debugging (That's for sure.) I know that in my office we talk of our dream insights all the time. The first few times were kind of 'wierd and funny', but now we really don't think anything of it at all. It's like a bonus resource that appears as a gift in the night.

    Sleep well monks, and sweet Perl dreams.

    - Mission
    "Heck I don't know how to do it either, but do you think that's going to stop me?!!"
Re: Do Monks dream of Perl sheep ?
by cacharbe (Curate) on May 20, 2001 at 15:31 UTC
    Happens to me all the time. I've been writing a lot of Win32::OLE code lately, and I've actually awakened from a dream to code because of the slick solution that has come forth from the depths of my subconscious.

    I also speak Japanese and French, and that can really mess with your mind. I've had dreams in Japanese before in which I've used words that my conscious mind has pretty much forgotten. So I know it's still in there, I just have to use it more.

    The dreaming phenomenon is a strong argument for some of Freud's arguments about the subconscious and the meaning of dreams. I'm not a Freud fan, but man, my brain can come up with some doozies when my conscious mind isn't mucking things up.


Re: Do Monks dream of Perl sheep ?
by Brovnik (Hermit) on May 19, 2001 at 04:55 UTC
    Having posted, I noticed an old thread on the subject, but hopefully still worthy of some discussion.
      to be honest, i don't dream of electric perl sheep. (blade runner is *such* a great movie, btw.) not yet, anyway. i do find myself thinking aloud in c++ or pascal frequently, much to the chagrin of a coworker of mine. :)

      of course, my background in those two languages is much stronger than my background in perl. i hope to be perl-ific enough in perl that it comes to me as a second nature. well, maybe that's setting my sights too high, but you get the point.

      coincidentally, while the subject of dreaming is up, i have a dream *completely* in french probably once a month or so. which is very strange, but i LOVE it. it lets me know i'm that much closer to fluency. :)

      # kendroid.