Re: [jruby-user] Re: JRuby 1.7.13: Why does [ "%0d" % nil ] not generate an error as it does under Ruby 1.9.3?

TJG <[email protected]>
Newsgroups gmane.comp.lang.jruby.user
Message-ID <CAAnEMzSdy8hJL2NDWVgz_230FUh0KmXAySrar1oSsF+-EM4nnw@mail.gmail.com>
Hi Karol;

Thanks for your comments... I'm unlikely to venture into fixing it myself,
but will report it.

It is a subtle difference that was difficult to find, and one that I
*least* expected to be the source of some grief when I ported my MRI app to
JRuby.

Many thanks,
Tim


On Tue, Sep 16, 2014 at 8:12 AM, Karol Bucek <[email protected]> wrote:

>
>  Hi Tim, JRuby tries to match MRI to the "max" ... so this is likely a
> 1.9.3 / 2.1 compatibility issue.
>
> If you need it I would report it (even better try to fix it on my own) -
> it's likely just adding a nil check on the right method (Java involved).
> Esp. since this might end up as lower priority since it's probably not
> that crucial to max the error being raise ... might be wrong here.
>
> Hope that explains your concerns, K.
>
>
>
> On Tue, Sep 16, 2014 at 1:42 PM, Tim Griffin <[email protected]>
> wrote:
>
>> Hi again,
>>
>> Anyone with any thoughts on this?
>> Tim
>>
>>
>> On Wed, Sep 10, 2014 at 12:20 PM, Tim Griffin <[email protected]>
>> wrote:
>>
>>> Hi all;
>>>
>>> I've just bumped into a little anomoly between JRuby 1.7.13 and Ruby
>>> 1.9.3.
>>>
>>> *Under Ruby 1.9.3:*
>>> This statement generates an error:
>>> 3] pry(#<Package>)> *p "%0d" % nil*
>>> TypeError: can't convert nil into Integer
>>> from (pry):8:in `%'
>>> [4] pry(#<Package>)>
>>>
>>> *Under JRuby 1.7.13:*
>>> The same statement does *not* generate an error:
>>> [4] pry(#<Package>)> p "%0d" % nil.0.0.0:8080-1) [4] pry(#<Package>)> *p
>>> "%0d" % nil*
>>> 12:07:07,902 INFO  [stdout] (http-/0.0.0.0:8080-1) "0"
>>> 12:07:07,903 INFO  [stdout] (http-/0.0.0.0:8080-1) => "0"
>>>
>>>
>>> Can anyone account for the difference? Which is the "correct" response?
>>>
>>> Thanks,
>>> Tim
>>>
>>>
>>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.