-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add compiler check that warns/errors on multiple defgates of the same name #797
Comments
If you're wary about building a hash set, you could just use symbol property lists instead. E.g.
and then I don't know how Lispers feel about symbol property lists these days though. It's a bit esoteric. Edit: You should definitely just use a hash set instead. |
Note that ambiguous definitions due to name conflicts are checked here. An This is later handled in a It's a mistake that this argument is not documented clearly, and there are no obvious options one can provide it. Currently it just "continues" (i.e., ignores the error without warning), but was clearly put here to anticipate a more descriptive action. Side note, it will error if there are conflicts in defined memory. You can see this here in a "functional disjunction" layering memory error handling on top of the user-supplied handler. Note the comment here. You can see how a memory error is actually handled here. The bottom line is this:
We might also consider a As @Spin1Half said, the original Quil paper, last sentence of section III.D, says conflicting definitions is undefined behavior. So that's the status quo. |
As of right now, having multiple defined gates of the same name is considered undefined behavior by the quil lang spec. It might be nice for quilc to have a quick check that verifies no duplicate names exist in the gate definitions of a parsed program object.
Remark: care should probably be taken to make this check take O(n) time in the number of gate defs as opposed to O(n^2) [although the O(n^2) approach allow the check to be in place while the O(n) approach requires building a hashset].
The text was updated successfully, but these errors were encountered: