[swift-evolution] [Review] SE-0101: Rename sizeof and related functions to comply with API Guidelines

Leonardo Pessoa me at lmpessoa.com
Tue Jun 21 12:40:09 CDT 2016


On 21 June 2016 at 14:03, Chris Lattner via swift-evolution
<swift-evolution at swift.org> wrote:
> Hello Swift community,
>
> The review of "SE-0101: Rename sizeof and related functions to comply with API Guidelines" begins now and runs through June 27. The proposal is available here:
>
>         https://github.com/apple/swift-evolution/blob/master/proposals/0101-standardizing-sizeof-naming.md
>
>         * What is your evaluation of the proposal?

After a carefull review of the proposal, I will be obligated to
decline it. After studying the proposal I ended up thinking I was
writing more code to get the data and in comparison with dynamicType
-> type(of:) it lead me to think at first the proposal would suggest
renaming size* functions to size(of*:) and so forth, which would seem
to go more towards the compared proposal (SE-0096). This idea doesn't
even made into the alternatives considered and I think it would making
reading and understanding the code much clearer than the proposed
nested function calls.

>         * Is the problem being addressed significant enough to warrant a change to Swift?

I'm not sure. Given the reasoning I'd say yes but given proposal
SE-0096 I'd say yes only if the new function names were to be
size(of*:), stride(of*:) and align(of*:) and thus not depending of the
nested result of type(of*:).

>         * Does this proposal fit well with the feel and direction of Swift?

I don't think so. As I said, when I finished reading the proposal, I
ended up thinking I was writing more code in the new version and it
didn't seem very clear to me what was the size I was getting.
Moreover, it seems I'll always have to invoke these functions to the
result of type(of*:) which would be unnecessary redundant code.

>         * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Many languages (like C/C++, C#, D) have both sizeof and typeof and in
most these two functions have similar names and syntaxes. In this case
I believe making them different makes it hard to discover those
functions exist and relate their purpose.

>         * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick study was enough for me.

L


More information about the swift-evolution mailing list