[swift-evolution] [Pitch] New Version of Array Proposal

Taylor Swift kelvin13ma at gmail.com
Sun Jul 23 11:32:54 CDT 2017


lol we might as well use a lozenge as the separator

let fsa:[3, 2 <> Int] = [3, 2 <> 1, 2, 3, 4, 5, 6]

Some languages like Pollen even go the unicode route and use an actual
lozenge

let fsa:[3, 2 ◊ Int] = [3, 2 ◊ 1, 2, 3, 4, 5, 6]

this character is actually very easy to type (≤ 3 keystrokes) in both OSX
and Linux, the only two platforms Swift is targeting currently. It’s also a
standard character present in every monospace font.

On Sun, Jul 23, 2017 at 12:18 PM, Robert Bennett <rltbennett at icloud.com>
wrote:

> I’ll throw my syntax suggestion into the mix: backslashed brackets for the
> braces, a colon for the separator.
>
> let fsa: \[3: Int\] = \[3: 1, 2, 3\]
>
> Or maybe go the string interpolation route and only backslash the first
> bracket.
>
> let fsa: \[3: Int] = \[3: 1, 2, 3]
>
> I think that looks pretty clean. For one-dimensional arrays, you could
> even omit the size and infer the type.
>
> let fsa = \[1, 2, 3] // Of type \[3: Int]
>
> And I agree with Taylor that the separator chosen should have no
> standalone use in the language — colon, semicolon, pound sign, etc are OK,
> but operators shouldn’t be used.
>
> On Jul 23, 2017, at 12:08 PM, Taylor Swift via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Using the *multiplication operator* as a *separator* character seems like
> an extraordinarily bad idea.
>
> let fsa:[2 * Int] = [2 * 5, 3] // [10, 3] ???
>
> On Sun, Jul 23, 2017 at 11:59 AM, David Sweeris <davesweeris at mac.com>
> wrote:
>
>>
>>
>> Sent from my iPhone
>>
>> On Jul 23, 2017, at 08:45, Taylor Swift via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>>
>>
>> On Sun, Jul 23, 2017 at 5:29 AM, Adrian Zubarev via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>>> I wanted to read the proposal, but skipped it as soon as I’ve seen the
>>> syntax. From the esthetic point of you the proposed syntax is really ugly.
>>> Again I’m not speaking against the feature in general, nor against any of
>>> the technical benefits fixed-size array will provide to us. I simply
>>> dislike the syntax, which in my opinion does not fit to Swift.
>>>
>>
>> What about a double colon?
>>
>> let fsa:[5, 2::Int] = [5, 2::[::0, 0]: 5, [::5, 1]: 6, default: -1]
>>
>>
>> I thought we'd mostly settled on "let fsa: [count * Type]" last time this
>> came up.
>>
>> - Dave Sweeris
>>
>
> _______________________________________________
> 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/20170723/f1bb2634/attachment.html>


More information about the swift-evolution mailing list