What to do when adding a comment makes your program behave differently?

Hi,

I a have built a program (433 lines) which takes a file as an argument,
processes it and provides its result to STDOUT.

When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

What can I do right now? (Except for switching to another language :wink:

TIA,

Erik.

P.S.: I am willing to send my code, but I expect it will work fine
elsewhere because it is probably a GC/timing related Ruby bug.

"Erik Terpstra" <erik@terpnet.nl> schrieb im Newsbeitrag
news:4215cb12$0$28982$e4fe514c@news.xs4all.nl...

Hi,

I a have built a program (433 lines) which takes a file as an argument,
processes it and provides its result to STDOUT.

When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

What can I do right now? (Except for switching to another language :wink:

TIA,

Erik.

P.S.: I am willing to send my code, but I expect it will work fine
elsewhere because it is probably a GC/timing related Ruby bug.

With that little information nobody really can help you with this. Please
post code (if it's larger, you might want to use a public pasting board
such as http://rafb.net/paste/ ) and probably your input file.

Kind regards

    robert

Erik Terpstra wrote:

When I add a comment (just a '#' character will do) below the last line
of the program, it works fine.

When I remove the comment it behaves differently, the result is
incorrect but Ruby does not give an error or a warning whatsoever. (I
don't have any rescue statements in my program).

Things like this might be caused when you're relying on the order of something unordered. Hash#keys, #values, the output of methods and other things have undefined order. Are you sure it is not something like this?