nostr-protocol / nips

Nostr Implementation Possibilities
2.39k stars 582 forks source link

until should not be inclusive #1502

Closed mleku closed 2 months ago

mleku commented 2 months ago

when you use the word "until" in english, it means exclusive:

Until conjunction up to the time that or when; till: He read until his guests arrived.

before (usually used in negative constructions): They did not come until the meeting was half over.

it does not say "as the meeting was half over" or "He read until when his guests arrived"

the meeting was past half over, on the other side of the half line

the guests arrival triggered the cessation of reading, thus it is quite specious to say that the fact that his attention was drawn to the arrival of his guests did not end his reading

@mikedilger 's relay test tests for precisely tho condition given in the nip-01:

  "since": <an integer unix timestamp in seconds. Events must have a created_at >= to this to pass>,
  "until": <an integer unix timestamp in seconds. Events must have a created_at <= to this to pass>,

until definitely does mean exclusive, and it is convention in computer programming to understand that in arrays subset expressions that you use "from = inclusive" and "until = exclusive"

it is a common error of beginner programmers to not understand this distinction but it is also a failure of understanding the definitions of these words in english, and the meanings are not only clear in this sense in english but to other languages, such as bulgarian "ot... do" the word "do" means "up unto the edge of" and is used to describe two objects abutted to each other as well, their locations being contiguous except for a narrow boundary, and i'm sure that almost every language you can poke a stick at, the usual translation matches up, such as portuguese "ate" which is the same as until

why this came to my attention is that when i tried to fix the query database filter to fit the spec, almost half the other tests fail, the boundary condition that the majority of tests pass, is the one where until is exclusive, ie, created_at < until.

it may well be the spec says this but the word says that, and i think the word should overrule and the spec should make it clear that since is inclusive and until is exclusive

mleku commented 2 months ago

closing because error is baked in... nvm

(not helping new programmers here tho, just saying)