From: Sean O'Dell Date: 2004-06-26T02:25:42+09:00 Subject: Re: Is it considered Harmful? On Friday 25 June 2004 10:11, Lennon Day-Reynolds wrote: > [snip] > > > No code should "expect" data to be there that isn't. If a C extension > > wraps a native C struct as a Ruby object with Make_Struct, then when it > > unwraps it, and gets nothing or a NULL pointer, it shouldn't continue to > > try and use it. That's sloppy coding. > > > > Sean O'Dell > > I agree with you about it being sloppy programming, but then again, > part of the reason that I write code in Ruby (and Python, Java, C#, > Perl, etc.) is so that I can be a little sloppy, without getting > segfaults or buffer overruns. Programming in C seems to consist mostly > of wrapping unsafe calls in error checks and handlers; I would hate to > see Ruby become similarly burdened due to low-level hacks like #class= > or #become entering the langauge core. I was actually speaking of Ruby C code, not so much Ruby script code. Ruby should be stable even in exceptional circumstances, although you might not get the results you're after. It still shouldn't crash. C code shouldn't use internal data without performing some checks, especially if the data makes the rounds to other libraries/extensions and such. Sean O'Dell