-
Notifications
You must be signed in to change notification settings - Fork 110
Description
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:
(component $C
(import "foo" (instance $i
(type $baz' (record))
(export $baz "baz" (type (eq $baz')))
(type $bar' (record (field "baz" $baz)))
(export $bar "bar" (type (eq $bar')))
))
(alias export $i "bar" (type $bar))
(type $ME (instance
(alias outer $C $bar (type $bar'))
(export $bar "bar" (type (eq $bar')))
))
)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?