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
Uh oh!
There was an error while loading. Please reload this page.
-
We have module as a type syntax.
And caller:
The module
a-modulemust have the same "type" assome-module, meaning all definitions insome-modulexmust also be present ina-modulewith same/compatible type.We can do the same for component as type:
And caller of
barneeds 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
fmust provide a record that is compatible withperson. When looking at compatibility, we check if all the methods/functions defined onpersonare 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