Open KOLANICH opened 7 years ago
I've proposed approximately the same syntax some time ago: https://github.com/kaitai-io/kaitai_struct/issues/78#issuecomment-272581874
Could you show what you propose for usage of your example template?
Could you show what you propose for usage of your example template?
This was just an example. The use cases are strings and other arrays prepended by count of elements, wrappers for data structures, where first structure must have certain type (see flac.ksy, the first frame is always metadata one), etc.
I would like to point out that its probably worth dictating how seq > type
should behave for this proposal prior to trying an implementation.
Like for example, what should happen if one of the template parameters is called u4
?
u4
?
Also, another consideration is depth and complexity of parameterization.
How should Kaitai react to parametric or template types being passed as template parameters?
Can we add an option to limit or permit these behaviors?
For example, should Katai (and how should Kaitai) abstract this signature:
class Template<T extends AnotherTemplate<TypeParameter>> { ... } // TypeScript
I think we need templates/generics, don't we? the proposed syntax:
All the template arguments should be known at compile time. For languages having templates/generics they should be used.