[swift-evolution] [Review] SE-0136: Memory Layout of Values

Brent Royal-Gordon brent at architechies.com
Tue Aug 9 03:32:31 CDT 2016


> On Aug 7, 2016, at 11:18 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 	* What is your evaluation of the proposal?

I don't think that making this public is so urgent that we need to approve it after the deadline.

I suspect that a syntax for talking about the types associated with a variable will emerge from the enhanced existential proposals. If one does, we will be able to use it here:

	MemoryLayout<pointer.Pointee>.size
	MemoryLayout<array.Element>.stride
	MemoryLayout<someComplexLazyFilteredArray.Self>.size

(You could use `size(ofValue:)` and friends with more complicated expressions, but that would mean evaluating them for no good reason. I'd say using `size(ofValue:)` with anything other than a simple variable is probably a smell.)

So that means this is:

1. A specialized feature,
2. Probably used far more by the standard library than anything else,
3. Which is a mere convenience,
4. Can be trivially added by any user who wants it,
5. And may no longer be necessary by the time generics are where we want them to be.

So why the rush? Why not keep the standard library's implementation private to the standard library?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list