f



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 ;-)

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.
0
erik4913 (34)
2/18/2005 11:01:37 AM
comp.lang.ruby 48886 articles. 0 followers. Post Follow

2 Replies
9713 Views

Similar Articles

[PageSpeed] 53

"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 ;-)
>
> 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

0
bob.news (3807)
2/18/2005 11:04:01 AM
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?
0
flgr (713)
2/18/2005 12:50:59 PM
Reply: