You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One can write UINT32 t[<= n] which raises a deprecation warning saying to instead use [:byte-size-at-most instead of [<=; but, this syntax does not exist. Instead, we support only [:byte-size-single-element-array-at-most
The semantics of T [:byte-size-single-element-array-at-most n] is that we validate the format of T and check that it fits within n bytes, and then we always consume exactly n bytes by advancing the position of the parser. So, this in effect allows one to encode an element T padded out to n bytes. However, the documentation about this feature does not mention anything about how many bytes are actually consumed. In fact, it might suggest that a variable number of bytes are consumed. We should fix the doc.
Conceptually, we could add another combinator which checks that a T is represented in at most n bytes, but consumed only exactly as many bytes as are needed to represent a T, without implicitly padding up to n. Such a combinator would inherit the the strong-prefix property of T.
The name of the *-at-most combinators are confusing, because they suggest that a variable number of bytes are consumed, when in fact we consume exactly n bytes. We should rename them.
One can write T x[n] and 3D issues a warning if sizeof(T) <> 1, saying use the :byte-size notation. This warning should be an error, since it's an easy mistake to overlook.
The text was updated successfully, but these errors were encountered:
One can write
UINT32 t[<= n]
which raises a deprecation warning saying to instead use[:byte-size-at-most
instead of[<=
; but, this syntax does not exist. Instead, we support only[:byte-size-single-element-array-at-most
The semantics of
T [:byte-size-single-element-array-at-most n]
is that we validate the format ofT
and check that it fits withinn
bytes, and then we always consume exactlyn
bytes by advancing the position of the parser. So, this in effect allows one to encode an elementT
padded out ton
bytes. However, the documentation about this feature does not mention anything about how many bytes are actually consumed. In fact, it might suggest that a variable number of bytes are consumed. We should fix the doc.Conceptually, we could add another combinator which checks that a
T
is represented in at mostn
bytes, but consumed only exactly as many bytes as are needed to represent aT
, without implicitly padding up ton
. Such a combinator would inherit the the strong-prefix property ofT
.The name of the *-at-most combinators are confusing, because they suggest that a variable number of bytes are consumed, when in fact we consume exactly
n
bytes. We should rename them.One can write
T x[n]
and 3D issues a warning if sizeof(T) <> 1, saying use the :byte-size notation. This warning should be an error, since it's an easy mistake to overlook.The text was updated successfully, but these errors were encountered: