Another way to explain why I'd like to be able to use my type(s) with for-in without getting all stuff from SequenceType et al might be by this example:TL;DR:My StaticArrayType(s) has type-level Count, thus SequenceType == bad fit, OK, fine, makes sense. But I'd still like to:for e in myStaticArray { … }I could have, if only the stdlib had a simpler protocol whose only requirement was that conforming types had a generate() method.I have a protocol called StaticArrayType which describes a set of common requirements for concrete (value) types that have/are a statically allocated fixed number of elements (of type Element). So the memory layout of any static array type is fixed and both its element type and its count are encoded at the type level by associated types Element: DefaultInitializable andCount: CountType.The Count type can be used to type check the number of elements and the Element type can be used to type check the element type.(The memory layout of any static array type is fixed and known since eg a
Topic:
Programming Languages
SubTopic:
Swift
Tags: