[Pitch 2] Safe loading of values from `RawSpan`

IIUC there'll be a problem specifying correct byte order for multi-component types like the mentioned: struct Point { var x, y: Int }

Consider having two sets of API's - one set for integers/floats with byte order parameter, another for other types without byte order parameter.

What happens when loading or storing from an invalid offset? I guess a trap? †

By the same logic, what if working with Range<Int> was allowed and worked fine when the bounds play fair, and traps when lowerBound is greater than upperBound? (The actual checking/trapping could be implemented in some later compiler version as in proposal.)


† BTW, have we considered making those API's throwing instead?

1 Like