[swift-evolution] [Review] SE-0024 "Optional Value Setter `??=`"
Thorsten Seitz
tseitz42 at icloud.com
Wed Feb 17 10:56:20 CST 2016
What is the difference to just using
dict[key] ?? "value"
-Thorsten
> Am 16.02.2016 um 20:12 schrieb James Campbell via swift-evolution <swift-evolution at swift.org>:
>
> So what would you guys feel to exposing a subscript method like mentioned, like so:
>
> dict.subscript("key", default:"value")
> dict.[]("key", default:"value")
> dict["key", default:"value"]
>
>
>
> ___________________________________
>
> James⎥Head of Awesome
>
> james at supmenow.com⎥supmenow.com
>
> Sup
>
> Runway East
>
>
> 10 Finsbury Square
>
> London
>
>
> EC2A 1AF
>
>
>> On Tue, Feb 16, 2016 at 6:42 PM, Sune Foldager via swift-evolution <swift-evolution at swift.org> wrote:
>> …and I of course meant Ruby when I said Python :p
>>
>> -Sune
>>
>>>> On 16 Feb 2016, at 19:38, Sune Foldager <cyano at me.com> wrote:
>>>>
>>>>
>>>> On 13 Feb 2016, at 06:15, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
>>>>
>>>> What is your evaluation of the proposal?
>>> I’m -1. My main objection is the same as others have brought up, namely that, contrary to ??, it keeps us in “optional land”. That is, a ??= b ~> a = a ?? b, so a must be optional.
>>>
>>>> Is the problem being addressed significant enough to warrant a change to Swift?
>>> I don’t think so. In Python, where ||= works, I do use that from time to time because it’s “idiomatic”, but I don’t really think it’s very obvious what it does. In Swift, my programming style is a bit different, and I don’t find myself needing it. Especially due to the way it keeps optional (which is obviously not an issue in Python).
>>>
>>>> Does this proposal fit well with the feel and direction of Swift?
>>> I don’t know, but I don’t think it’s a very important addition and can lead to confusion instead.
>>>
>>>> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>>> Read the responses. Thought about my own use, and looked at some Python and Swift code.
>>>
>>> -Sune
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> 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/20160217/33976f37/attachment.html>
More information about the swift-evolution
mailing list