|The stupid question is the question not asked|
I also had a time where I dreamed code. I remember even some situations where it was good code that solved a problem I had a day before, so I woke up next day and basically wrote down what I dreamed the night before. But of course most times there just was the way I could remember not the code lines themself.
For some reason this stopped completly after a while, I didn't have any coding-dreams for quite a while now and I must say I'm quite happy with this.
Of couse it's kinda funny and can really help in some situations but is it good to "think" while sleeping?
I think it's not. Your body needs time to refresh, and your brain definitly also does. I found out that I'm much more refreshed and so can be more active and do better coding when I had a dreamless sleep.
But we also have to seperate between normal "dreams" and dreams where your brain still thinks about everything. I also dreamed of chess-games when I was playing chess lots and I often dreamed of stock-charts when I did lots of trading.
You always dream about such things when you can't leave them behind you once you left your desk...but I think you should try to really sleep and not only sleep with some parts of your body/mind...or you probably will get ill one day, getting serious problems to sleep etc.
We already had such a discussion in the chatterbox I can remember and came to the conclusion that lots of coders don't sleep much and not very well. The deep-sleep-phase is kinda missing in lots of peoples sleep-time and that's what everyone should try to change.
Good ways to do this I found out for myself are doing things like meditation (no not perl-meditation :) or going for walks in the nature for example. Find something to get your head clear (no drugs are bad!)...
I hope I didn't miss the topic to much :)