-
Notifications
You must be signed in to change notification settings - Fork 137
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
Define what a "Primitive Type" is in Cadence #2929
Comments
@darkdrag00nv2 this is probably required for #2803 |
@j1010001 yeah, wondering if we need to limit the function on just primitive/containers of primitives though. Asked on the PR: #2945 (comment) |
@turbolent @SupunS Any idea on how we want to approach defining a "Primitive" in Cadence? Like should this be a type, may be a subtype of |
I guess the requirement here is mostly for the implementation of the types, correct? i.e: an implementation detail rather than a user-facing separation of types. In that case, a simple function on Having said that, what is the separation that is being required here? is it just container (arrays, dictionaries, composite) types vs non-container types? In the stable-cadence branch, I've introduced the same functionality by means of of function Lines 142 to 161 in 787812f
The original purpose of that method was to determine if a reference should be returned during member access, but if the 'technical' requirement is the same, then we can re-purpose/re-name it to something more generic |
I think in our documentation we never defined or used the term 'primitive type' so far (the member access semantics use the term 'container type' vs 'non-container-type'). If we are going to use that technical grouping in multiple features, maybe it's a good idea to formalize/standardize this grouping (so the terminology is consistent across features/documentation) and also add it to the documentation as well. |
@SupunS Yes, for the dereference feature, container vs non-container should be sufficient. |
Actually, there are two slightly different requirements. #2928 - primitives (int, bool, string) VS complex (array, dictionary, composite) So I guess we could define primitives as int, bool, string etc. and then #2803 will have to also include containers of primitives separately. |
Note that primitive types should also include |
@dsainati1 It should be possible now to update https://github.com/onflow/cadence/pull/2928/files#diff-c34bee2125d8f3673160cc7b3c912540ad811b4622a66c3a2ed6c25fc94e1cb0R2091 based on #2975 |
Issue to be solved
Some logic (like in #2928) relies on a soft definition of certain types (e.g. string, int, bool) in Cadence being "primitive", as opposed to a complex type like an array, dictionary or composite. We should concretize this by specifying exactly which types are primitive vs concrete.
Suggested Solution
No response
The text was updated successfully, but these errors were encountered: