Talk:Parse an IP Address: Difference between revisions

From Rosetta Code
Content added Content deleted
(Decimal requirement)
 
(→‎Sloppy: new section)
Line 1: Line 1:
Hm. I'm thinking the decimal number requirement isn't necessary. Removing. --[[User:Short Circuit|Michael Mol]] 12:35, 27 September 2011 (UTC)
Hm. I'm thinking the decimal number requirement isn't necessary. Removing. --[[User:Short Circuit|Michael Mol]] 12:35, 27 September 2011 (UTC)

== Sloppy ==

This task currently seems sloppy.

First, it requires that extra data (the port) be ignored. In practical use, if the port is being passed to a routine that parses ip addresses, this probably means the data is being mishandled. So good practice suggests that this be treated as an error case. This is a minor but annoying complexity in the task.

Second, it asks us to mix ipv4 and ipv6 addresses but ipv4 addresses have a representation as ipv6 addresses (see rfc 2373, for example) but the example implementation mixes them in the same data structure without labeling the type and without using a consistent mapping.

I can think of several ways to go here:

# Discard the port parsing requirement
# Ask for ip,port to be reported as a pair
# Ask for ipv4 and ipv6 address results to be distinguished (or put them in separate tasks)
# Ask for the ipv4 addresses to be encoded as ipv6 addresses (127.0.0.1 becomes ::127.0.0.1 to distinguish it from ::7f00:1).
# change the task to make some of these issues moot

But I am not sure which way to go here. --[[User:Rdm|Rdm]] 13:58, 28 September 2011 (UTC)

Revision as of 13:58, 28 September 2011

Hm. I'm thinking the decimal number requirement isn't necessary. Removing. --Michael Mol 12:35, 27 September 2011 (UTC)

Sloppy

This task currently seems sloppy.

First, it requires that extra data (the port) be ignored. In practical use, if the port is being passed to a routine that parses ip addresses, this probably means the data is being mishandled. So good practice suggests that this be treated as an error case. This is a minor but annoying complexity in the task.

Second, it asks us to mix ipv4 and ipv6 addresses but ipv4 addresses have a representation as ipv6 addresses (see rfc 2373, for example) but the example implementation mixes them in the same data structure without labeling the type and without using a consistent mapping.

I can think of several ways to go here:

  1. Discard the port parsing requirement
  2. Ask for ip,port to be reported as a pair
  3. Ask for ipv4 and ipv6 address results to be distinguished (or put them in separate tasks)
  4. Ask for the ipv4 addresses to be encoded as ipv6 addresses (127.0.0.1 becomes ::127.0.0.1 to distinguish it from ::7f00:1).
  5. change the task to make some of these issues moot

But I am not sure which way to go here. --Rdm 13:58, 28 September 2011 (UTC)