module/component/function/record as a types #2031
amitu
started this conversation in
Ideas & RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have module as a type syntax.
And caller:
The module
a-module
must have the same "type" assome-module
, meaning all definitions insome-module
x
must also be present ina-module
with same/compatible type.We can do the same for component as type:
And caller of
bar
needs to provide a component with signature compatible withfoo
,. and function with signature compatible withsome-fn
.Record Typ
Record types can be considered traits.
Caller of
f
must provide a record that is compatible withperson
. When looking at compatibility, we check if all the methods/functions defined onperson
are present with same signature on the provided type.Also the fields of the record must either be present in the provided record with same type, or a getting/setter with appropriate name must be present on the provided record, and will be called transparently.
Beta Was this translation helpful? Give feedback.
All reactions