[ruby-core:33748] Proposal: IPAddress in the standard library

7 views
Skip to first unread message

Marco Ceresa

unread,
Dec 16, 2010, 2:31:35 AM12/16/10
to ruby...@ruby-lang.org, Akinori MUSHA
Hello,

IPAddress [1] is a library to manipulate IPv4 and IPv6 addresses. It
has been written as a replacement for IPAddr, trying to fix some of
its bugs, and at the same time extending its functionalities and
offering a more powerful and flexible interface.

Migrating from IPAddr to IPAddress is very easy, as most of the
methods have the same name and same behaviour. Moreover, IPAddress is
around 50% faster than IPAddr, and it's very well documented in each
of its parts. The code is very clear, easy to read, to maintain and to
extend, consisting mostly of one line methods.

I've been in touch with the maintainer of IPAddr, Mr. Akinori MUSHA,
asking him if he would consider IPAddress as a replacement, and he
suggested me to write to -core.

I think IPAddress is mature enough, so here is my proposal. Let me
know what you think.

Best regards,
Marco

[1] https://github.com/bluemonk/ipaddress

Simone Carletti

unread,
Dec 17, 2010, 8:59:58 AM12/17/10
to ruby...@ruby-lang.org
I'm really interested in this topic.

I the last couple of years I had to deal with IP manipulation several times,
especially for the Whois ( http://www.ruby-whois.org ) and Net::DNS gems.

I had the chance to give IPAddress a try in the past,
and I really enjoyed it. The current IPAddr implementation doesn't expose some very useful methods,
such as the ability to validate an IP Address on-the-fly without instantiating an IPAddr object,
and I often had to rely on hacks or cut&paste to accomplish this.

Also, IPAddr has a couple of weird bugs when you have to work with IP ranges
(thanks to Marco for helping me spotting them out in the past ;) ).

I'm really curious to know if the Ruby would consider this proposal.

-- Simone

Yukihiro Matsumoto

unread,
Dec 17, 2010, 9:52:30 AM12/17/10
to ruby...@ruby-lang.org
Hi,

The proposal itself is very interesting. So are you proposing to add
IPAddress along with IPAddr, or replacing it? I don't want to have
two separate libraries to do (almost) same thing. We did similar
mistakes in the past. Please no more.

Replacing is OK for me, if we can keep fundamental backward
compatibility, and the current IPAddr maintainer (knu) agrees.

matz.

message "Re: [ruby-core:33748] Proposal: IPAddress in the standard library"

Marco Ceresa

unread,
Dec 20, 2010, 3:22:41 AM12/20/10
to ruby...@ruby-lang.org
On Fri, Dec 17, 2010 at 3:52 PM, Yukihiro Matsumoto <ma...@ruby-lang.org> wrote:

> The proposal itself is very interesting.  So are you proposing to add
> IPAddress along with IPAddr, or replacing it?

Replacing it.
I don't think it's a good idea to have duplicated libraries in the stdlib.

> I don't want to have
> two separate libraries to do (almost) same thing.  We did similar
> mistakes in the past.  Please no more.

Couldn't agree more.

> Replacing is OK for me, if we can keep fundamental backward
> compatibility,

Backward compatibility was a goal since release 0.6, and I think we
did a good job. Users familiar with IPAddr will feel at home with
IPAddress, as most of the methods have same name and behaviour, and
you can pretty much replace "IPAddr.new" with "IPAddress.parse"
everywhere, expecting the same results.

I encourage anyone interested to install the gem and check if they
feel backward compatibility is good enough.

> and the current IPAddr maintainer (knu) agrees.

I'll write him again about that.

Thanks,
Marco

Reply all
Reply to author
Forward
0 new messages