-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support barrier;
, that is barrier with no qubit args
#71
Conversation
For this kind of thing, It's not super important, it just means that in most uses, the caller has to call |
I don't follow 100%. But I get the general idea. For example, this is clearly better to me: pub fn qubits(&self) -> Option<&Vec<TExpr>> {
self.qubits.as_ref()
} But it looks like you are asking for something else? |
I'm asking for this:
which is more proper Rust and will automatically resolve the type-hint reference. A |
Downstream code can work with |
This pub fn qubits(&self) -> Option<&[TExpr]> {
self.qubits.as_ref()
} gives me error[E0308]: mismatched types
--> crates/oq3_semantics/src/asg.rs:610:9
|
609 | pub fn qubits(&self) -> Option<&[TExpr]> {
| ---------------- expected `Option<&[TExpr]>` because of return type
610 | self.qubits.as_ref()
| ^^^^^^^^^^^^^^^^^^^^ expected `Option<&[TExpr]>`, found `Option<&Vec<TExpr>>`
|
= note: expected enum `Option<&[TExpr]>`
found enum `Option<&Vec<TExpr>>` |
Oh sorry, should be |
Ah ok.
This is definitely something we want. |
Honestly, it's not a blocker or anything like that, and it's probably fairly unlikely to be having any real impact on performance, it's mostly just around enabling idiomatic use of the interfaces. |
The compiler was not smart enough in this case to suggest I like the idea of using idiomatic code, because it serves as a model. and it is only extra effort to learn it the first time (or few times!). Even if in a particular case it is not important for performance. |
That actually could be a reasonable suggestion for an error message for |
See comments at bottom of #71
Closes #58