[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue

Patrick Smith pgwsmith at gmail.com
Thu Jun 2 02:15:32 CDT 2016


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 <xiaodi.wu at gmail.com> wrote:
> 
> On Thu, Jun 2, 2016 at 12:37 AM, Patrick Smith <pgwsmith at gmail.com <mailto:pgwsmith at gmail.com>> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160602/64d0f9ea/attachment.html>


More information about the swift-evolution mailing list