You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 17, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 17, 2022. It is now read-only.
Hm, yeah, I see your point. I suppose we could think of fixed-length lists as another specialization (e.g., as optional is a specialization of variant).
I'd say this is in the same category as not having e.g. integer subrange types. If you know your value range of a parameter is 0..9999, you still have to use u16 or something (or a quadruple of decimal digits :) ). You can't express intent more specifically.
The reason low-level languages like C or Rust include the array size in their types is mostly because their representations depend on it. In higher-level languages that is not typically the case and the size it is not normally included. And I would count interface types among those higher-level type systems.
Attempts to allow capturing domain-specific semantics beyond mere representation are a huge can of worms for a type system, because there will always be the next case that you cannot express – e.g., what if the length of the list is given by another parameter? There are solutions to this, but none that you'd want to put into a cross-language IDL.
Activity
lukewagner commentedon Jan 26, 2022
Hm, yeah, I see your point. I suppose we could think of fixed-length lists as another specialization (e.g., as
optionalis a specialization ofvariant).rossberg commentedon Jan 26, 2022
I'd say this is in the same category as not having e.g. integer subrange types. If you know your value range of a parameter is 0..9999, you still have to use u16 or something (or a quadruple of decimal digits :) ). You can't express intent more specifically.
The reason low-level languages like C or Rust include the array size in their types is mostly because their representations depend on it. In higher-level languages that is not typically the case and the size it is not normally included. And I would count interface types among those higher-level type systems.
Attempts to allow capturing domain-specific semantics beyond mere representation are a huge can of worms for a type system, because there will always be the next case that you cannot express – e.g., what if the length of the list is given by another parameter? There are solutions to this, but none that you'd want to put into a cross-language IDL.