From: Nikolai Weibull Date: 2006-07-24T05:32:17+09:00 Subject: Re: [YAY] my sandboxing extension!! On 7/23/06, Mathieu Bouchard wrote: > On Mon, 24 Jul 2006, Nikolai Weibull wrote: > > On 7/23/06, Mathieu Bouchard wrote: > >> VALUE foo = rb_funcall((VALUE)3,rb_intern("<<"),INT2NUM(n)); > > Yuck, that's really nasty > Thank you! If you can't think of a better solution, don't call it nasty. Wow. You totally misinterpreted that. I meant nasty as in "clever hack", not as in "you suck, please email me back an unpleasant response to this mail". Sorry about me being unclear on that point. (And now that I've vented /my/ pent-up anger, please except my apologies for using a formulation that I didn't realize you might find offensive. I did figure that the "it's a solution, however" comment would clear up any such misinterpretation, however.) (To continue, the "yuck" substituted my inital "euh", which I couldn't figure out how to spell, so I used a word that I can spell to mean the feeling of "I don't want to touch that thing, it may be sticky.) > A solution not running in O(n) can't be called better, and I can't think > of anything else in O(n), can you? A better solution would be to provide an interface for it. However, a solution that feels a bit less "clever hackyish" is to simply copy over bignew_1() and bignew() from bignum.c, although the code duplication and possibility of not syncing with upstream changes makes for a less than good solution. > > (INT2FIX() is sufficient, though). > > If you mean vs INT2NUM, this hardly makes any difference. That is what I meant, and no it doesn't, but we have it and we know we can use it, so why not do so? It was just an observation, not a complaint. > If you mean (VALUE)3, I don't know why I didn't write INT2NUM(1) or > INT2FIX(1) instead, but as it is, it doesn't make any difference either. I thought it was kind of cute, but INT2*(1) would perhaps make it look less "nasty". nikolai