[swift-evolution] Renaming bitPattern and truncatingBitPattern
Jacob Bandes-Storch
jtbandes at gmail.com
Tue Feb 16 15:51:12 CST 2016
More brainstorming:
UInt8(bitsOf: someInt8)
UInt8(byTruncating: someBiggerInt)
On Tue, Feb 16, 2016 at 1:37 PM, David Turnbull via swift-evolution <
swift-evolution at swift.org> wrote:
> I propose upgrading bit-casting labels to match the new API design
> guidelines. Here's what we have today:
>
> UInt8(bitPattern: someInt8)
> Uint8(truncatingBitPattern: someBiggerInt)
>
> "Bit pattern" has the needless word "pattern" while not reading well due
> to the lack of a verb or preposition. Simply "bits" will not be confused
> with something else in this context. "Truncating" is the present participle
> which is confusing.
>
> I like:
> UInt8(fromBits: someInt8)
> Uint8(truncateBits: someBiggerInt)
>
> -david
>
>
> On Tue, Feb 16, 2016 at 11:29 AM, Dave Abrahams via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>>
>> on Tue Feb 16 2016, David Turnbull <swift-evolution at swift.org> wrote:
>> >
>> > My last week was spent reading files with huffman coding. So I had no
>> > choice but to use bitwise operations. My experience is that Swift got
>> this
>> > right (except for "truncatingBitPattern" taking up 25% of an 80 column
>> > line).
>>
>> Suggestions for improved names welcomed.
>>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160216/98c0f5b1/attachment.html>
More information about the swift-evolution
mailing list