I am trying to implement the i;ascii-numeric comparator and
according to rfc 2244 : "All values which do not begin with a US-ASCII
digit are considered equal with an ordinal value higher than all non-NIL
single-valued"
Seems pretty clear to me.
I understand for this that if I have a value that begins with other
that a digit, i give it the highest value in my interval (for ex. 2^32
given an interval of 0 - 2^32-1).
That's an implementation detail.
But what happens if I compare 2 values
starting with a non-digit character? Are they equal?
Of course they are. I fail to see what part of "all values which do not begin
with a US-ASCII digit are considered equal" is in any way unclear.
What if I have a "" string (a NULL value)?
It is also equal. Numeric comparisons only make sense for numbers.
If i make the assumtion that all values starting with a non-digit or
NULL value are equal to 2^32, then the following code will behave wrong
I see nothing "wrong" about it.
if address :is :all :i;ascii-numeric "To" "aa" {
discard;
}
I assume you meant "if address :is :all :comparator "i;ascii-numeric" ...",
but in any case, this test will return true if the address doesn't
begin with a digit and false if it does.
if address :is :all :i;ascii-numeric "From" "" {
discard;
}
Same thing.
both tests will evaluate to true
Incorrect. There are cases where they will return "false".
which, for the seccond case, explicitly
contradicts the base RFC (3028)
I see no contradiction here, but if there is it is it is the base specification
that needs to be changed. Comparators in general can completely change the
result that's returned. That's what they are for. But as long as they behave
consistently and meet the (minimal) constraints imposed on comparator behavior
there is no problem.
Ned