-
Notifications
You must be signed in to change notification settings - Fork 205
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
Enforce return types on interface view types #14570
Comments
I believe this matches the rules we want: daml/daml-lf/interface/src/main/scala/com/digitalasset/daml/lf/iface/reader/InterfaceReader.scala Lines 248 to 256 in 531221d
In other words
So the LF representation of |
I'm not sure we want to allow unit. That still means we cannot just expose a |
We can use absence of a One thing that was unclear from the design was whether a view would be required. It makes sense to me that it wouldn't be required, but permitting On the ledger API, we can interpret absence of a view as just stated, though it might make more sense to just reject transaction filters that specify interfaces whose viewtype is |
Currently we make it mandatory and I’d keep this. It means interface subscriptions always work exactly like template subscriptions and there are no interfaces you cannot subscribe to or get no meaningful return value. Relaxing it later to make them optional is also backwards compatible while the inverse isn’t so I’d start with the more restricted version. If in our tests this becomes fairly annoying, we can define a shared record type (like Archive) that we use instead of unit where we don’t care about the view. |
@cocreature Do you mean, "it must be present, and must refer to a record type with no type arguments"?
It already would be, I'd wager. #14456 contains 79 uses of |
yes |
Many of them are typechecked, too, unfortunately. |
True but
doesn’t seem that terrible. |
You're right it looks fine - started work on this in https://github.com/digital-asset/daml/tree/non-unit-viewtypes |
The design tries to keep the view types equivalent to templates, i.e., records with no type arguments. Daml Engine & the typechecker does not.
We need to change one of the two. I think changing Daml Engine makes more sense.
The text was updated successfully, but these errors were encountered: