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

Should we be allowing Const nodes with void types? #1873

Open
doug-q opened this issue Jan 17, 2025 · 3 comments
Open

Should we be allowing Const nodes with void types? #1873

doug-q opened this issue Jan 17, 2025 · 3 comments

Comments

@doug-q
Copy link
Collaborator

doug-q commented Jan 17, 2025

By void type I mean sums with 0 variants.

This type is very useful and I am not advocating touching it.

We should be able to infer from a wire of void type that it's source never terminates. For example, you can return a void type from panic no problem. But what does LoadConstant a Const of void type mean?

@cqc-alec
Copy link
Collaborator

Since there can be no value of void type, it should be impossible to construct a Const of void type, right?

@doug-q
Copy link
Collaborator Author

doug-q commented Jan 17, 2025

Hmm, yes for Value::Sum but you can make a CustomConst that reports it as it's type. Maybe that's ok? Maybe the semantics of LoadConstanting your constant is that it runs a web server forever

@cqc-alec
Copy link
Collaborator

Whether or not we formally allow it in a HUGR I think anything downstream trying to compile or interpret it would be well within its rights to throw up its hands in despair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants