<div dir="ltr">Sorry if this has been asked before (searched but couldn&#39;t find anything).<div>I&#39;ll explain what I mean by an example of a situation where I think it would be reasonable to expect a compile time error rather than the current runtime error:<br><div><div><br></div><div>import simd</div><div>let a: float4 = [1, 2, 3]</div><div>print(a)</div></div><div><br></div><div><div>The SIMD float4 type conforms to ArrayLiteralConvertible, and the required initializer has a check that makes sure the array literal has 4 elements.</div></div><div>The check can only be performed at runtime even though the number of elements of that array literal is (presumably) statically knowable, as is the number it is checked against (i.e. it probably ends up being an integer literal 4 somewhere (although I haven&#39;t actually checked the code)).<br></div><div><br></div><div>I assume that there are good reasons for why this is currently a runtime check, but I&#39;d like to know what these reasons are, i.e. why isn&#39;t there something like C++&#39;s static_assert?</div></div><div><br></div><div>Any pointers to previous discussions or information about how Swift relates to this and similar topics (static computation / constexpr, macro system) would be highly appreciated.</div><div><br></div><div>/Jens</div></div>