
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Scott Dial wrote:
The purpose is to avoid conflating IPNetwork with an IPAddress that has a mask.
I'm not confused by anything in this discussion except the repeated harping on the (to me imaginary) concept of "address with a mask". Conceptually: - Addresses don't have masks: they are just 32- (128-) bit integers. - Any given address can belong to a number of networks, based on a given topology. - Masks are also 32- (128-) bit integers, which happen to have the property that their leftmost N bits are all zero and the rest are all one. - One can construct a network from the combination of an address and a mask. Such a network *never* needs to know what the address was before masking. - Networks *do* know their "zero" address, as well as their "last address", and can do "containment" operations on addresses (I'm not clear on the need to do such operations on other networks, rather than just using their zero addresses). At the API level, it is convenient to represent the combination (address, mask) as a single string (e.g., '192.168.1.0/24'): parsing that string should return a network, not an address. Let's keep the "parsing human readable / writable strings" part separate from the clear conceptual map.
If the IPNetwork didn't accept a non-zero host and instead required a developer to use a helper to construct a IPNetwork with a proper address, then there would be less confusion about what exactly a IPNetwork is meant to represent. As it stands, it's purposes is muddled by accepting host addresses too.
I can't imagine why it would be useful to try to infer a network from an address: "In the face of ambiguity, refuse the temptation to guess."
I am rather indifferent whether there needs to be a IPAddressWithMask type. If that is needed, then it is rather easy to create a type that does that. And, if it is a common pattern, then it could be added to the module later in life.
Agreed. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFKsbeU+gerLs4ltQ4RAlG0AJ9ZvhuXHsTL2hheW/vlzeMmArs5rgCeLDLS eKWSAdkdv++umepu+nK0/7I= =N7ej -----END PGP SIGNATURE-----