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
Implement string and byte array support as described in
OpenCyphal/specification#51. The grammar has been modified
as follows:
- Add `utf8` primitive.
- Add `byte` primitive.
- Remove the unnecessary form `saturated bool`, which was shorthand for
`bool`, for regularity. From now on, only unqualified `bool` is allowed.
The expected impact is zero since the long form was never seen in the
wild. Note that `truncated bool` was never legal.
At the moment, the following constraints are enforced; they may be
lifted in the future:
- `utf8` can only be used as an element type of a variable-length array:
```
utf8[<=10] name # valid
utf8[10] name # invalid
utf8 name # invalid
```
- `byte` can only be used as an element type of an array:
```
byte[<=10] data # valid
byte[10] data # valid
byte data # invalid
```
Both `utf8` and `byte` are concrete instances of `UnsignedIntegerType`.
By virtue of this, existing users of PyDSDL (like Nunavut) will
interpret both `utf8` and `byte` as `truncated uint8`, until explicitly
updated to take advantage of the new feature. That is:
```
utf8[<=10] name # seen by Nunavut as: truncated uint8[<=10]
utf8[10] name # frontend error
utf8 name # frontend error
byte[<=10] data # seen by Nunavut as: truncated uint8[<=10]
byte[10] data # seen by Nunavut as: truncated uint8[10]
byte data # frontend error
```
Property `pydsdl.ArrayType.string_like` is now deprecated and should be
replaced with an explicit `isinstance(array.element_type,
pydsdl.UTF8Type)`.
Some internal refactoring has been done to unify the deprecation
consistency checking with the aggregation constraints listed above
(e.g., `utf8[<=10]` is valid but `utf8[10]` is not).
Closes#96
Relates to OpenCyphal/yakut#65
0 commit comments