[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue
Erica Sadun
erica at ericasadun.com
Thu Jun 2 15:46:03 CDT 2016
> On Jun 2, 2016, at 2:43 PM, Russ Bishop <xenadu at gmail.com> wrote:
>
>
>> On Jun 2, 2016, at 11:30 AM, John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> I still think the value-based APIs are misleading and that it would be better to ask people to just use a type explicitly.
>>
>> John.
>
>
> I agree; in fact why aren’t these properties on the type itself? The type is what matters; why can’t the type just tell me it’s size?
> Having free functions or magic operators seems to be another holdover from C.
>
>
> Int.size
> Int.alignment
> Int.spacing
>
> let x: Any = 5
> type(of: x).size
>
>
> The compiler should be able to statically know the first three values and inline them. The second is discovering the size dynamically.
>
>
> Russ
If achievable, this would certainly be clean and elegant.
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160602/5f1e8d6a/attachment.html>
More information about the swift-evolution
mailing list