Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The spec does not define equality for tuples or structs. #542

Closed
mihaibudiu opened this issue Dec 22, 2017 · 2 comments
Closed

The spec does not define equality for tuples or structs. #542

mihaibudiu opened this issue Dec 22, 2017 · 2 comments

Comments

@mihaibudiu
Copy link
Contributor

I think we should extend the spec rather than forbid these operations.

@jamescoole-cisco
Copy link
Contributor

Makes sense to me. We may also want to consider defining it for headers.

mihaibudiu pushed a commit that referenced this issue Dec 22, 2017
@jamescoole-cisco
Copy link
Contributor

The language for structs includes a requirement that their fields be recursively comparable

Two structs can be compared for equality (==) or inequality (!=) only if they have the same type and all of their fields can be recursively compared for equality.

but this language is missing for headers

Two headers can be compared for equality (==) or inequality (!=) only if they have the same type.

However, varbits can appear in headers but don't appear to be directly comparable

Variable-length bit-strings support a limited set of operations:
- Parser extraction into a variable-sized bit-string using the
two-argument `extract` method of a `packet_in` extern object
(see Section [#sec-packet-lookahead]). This operation sets the
dynamic width of the field.
- Assignment to another variable-sized bit-string. The target of the
assignment must have the same static width as the source. When
executed, the assignment sets the dynamic width of the target to the
dynamic width of the source.
- The `emit` method of a `packet_out` extern object, which
inserts a variable-sized bit-string with a known dynamic width into
the packet being constructed (see Section [#sec-deparse]).

It seems like we should allow comparing headers that contain varbits, but if we're going to allow that we should probably also define == and != for varbits so they can be directly compared as well.

mihaibudiu pushed a commit that referenced this issue Jan 24, 2018
jnfoster added a commit that referenced this issue Mar 5, 2018
@jnfoster jnfoster closed this as completed Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants