Open danielcompton opened 9 years ago
Yes -- it's an unfortunate side-effect of design decisions made elsewhere. Pervasively inet.data
treats malformed data as a non-exceptional condition, returning nil
on representation-parsing errors instead of throwing an exception. The library uses protocols to allow direct use of alternative representations in functions like network-contains?
. This latter decision makes it convenient to use alternative compatible objects (like standard library InetAddress
instances), and leads to compact-reading examples when using string representations; but it also leads to a number of bad/unexpected interactions like the one here, and was probably a mistake overall.
I'm open to improvements to the basic design, but fear it would be fairly extensive -- something along the lines of (a) distinguishing direct vs indirect representations, (b) introducing new functions which coerce as-necessary to a direct representation, throwing an exception if they fail, and (c) updating the library to pervasively use those functions.
It seems like
network-contains?
doesn't validate that it's comparing networks, and will compare arbitrary strings. Is this intended?