Yeah I realise who Dave is :) Ok, that’s good to know about your uses. An extra benefit that MemoryLayout has is a developer who is familiar with sizeof() from other languages (I only know of C), if it was called the same thing in Swift they might just go ahead and use it and add their own alignment tricks. Whereas a MemoryLayout type ties of all this functionality together in the one place, where they can discover that `stride`/`spacing` might serve them better.
Patrick > On 2 Jun 2016, at 4:23 PM, Xiaodi Wu <[email protected]> wrote: > > On Thu, Jun 2, 2016 at 12:37 AM, Patrick Smith <[email protected] > <mailto:[email protected]>> wrote: > Yes but, if they weren’t functions now, what would be the best design? > > Dave's suggestions then were made in the context of a language that had > `.dynamicType`. The question today is how best to align these functions with > `type(of:)`. If we were to ignore this context, I'm not sure on what basis we > could judge whether a property or function is 'best' for these facilities. > > How many Swift developers will be using this functionality? Less than 1%? I > trust Dave’s judgement because he is in that small group. > > I would caution against this assumption. I'm not a particularly advanced > developer by any stretch of the imagination, and I've been using `strideof()` > plenty of times while doing some math with Accelerate.framework and Metal > buffers. That said, Dave's in a very small group indeed, the group that wrote > these functions to start with.
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
