-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow implicit discard of qubits at the end of main #781
Comments
Note that we still need to generate Hugr discards which is not entirely trivial when considering nested structs, arrays, and lists. Also, would this be a special case for the qubit type only? |
I think it should apply to all linear types. An executable should be allowed to exit without having to clean up after itself. But this makes me wonder if we should change the type checker rather than guppy (so it would need to understand the concept of a main program). |
|
Seems a good idea -- for example, an output stream would want to flush itself when dropped. Not sure if we have any non-trivial examples in guppy at the moment?
Yes, better than relying on a function name. |
Qubits leftover at the end of main are being discarded anyway, users shouldn't have to do it manually just to satisfy the type checker. This should significantly reduce the need for
discard
calls - in programs that don't use ancillas.The text was updated successfully, but these errors were encountered: