Closed alexcrichton closed 1 year ago
I agree that the example should be valid and that the approach you describe of not requiring the "all types named" property for instance types sounds right.
The only part I don't follow is the last bit about "if "foo"
wasn't imported ...": it wouldn't be valid because you can't alias export
an instance type (only an instance), but I think that's not what you're getting at; however I can't tell what example you have in mind.
Ok sounds good! Also good point! I don't have an example in mind per se, but I'll stick to the "don't validate instances and instead defer their validation to when they get attached to components" logic
I think this matches the current wording in Binary.md, so closing as resolved, but feel free to reopen if otherwise.
I left a comment on the PR for the initial implementation of resources with some more info, but the gist is a question of whether or not this is a valid component:
Specifically the
$ME
type exports a named record$bar
which internally refers to another record$baz
, but the type$ME
doesn't export the$baz
type. This means that in isolation$ME
is not a valid instance, but in the context of this component it's valid since the$baz
type is imported via the"foo"
import.My heavy-handed solution to this problem arising was to completely disable all validation of "are types properly exported/imported/named/etc" for instance type definitions. When the instance type is attached to a concrete component or a component type, however, validation runs. So for example if
"foo"
wasn't imported then this would be an invalid component.I wanted to confirm though that this was reasonable behavior?