[swift-evolution] [Proposal Idea] dot shorthand for instance members

Rob Mayoff mayoff at dqd.com
Sat Dec 19 01:37:36 CST 2015


When you access a static member of a type using the dot shortcut, Swift
evaluates the expression immediately.

Are you proposing that when you access a member of an instance, Swift
generate a closure?

Or are you proposing that Swift generate a closure or not depending on how
the expression's value is to be used?

Either way seems inconsistent with the static member situation, and like a
potential source of confusion: not everyone uses the One True Convention™
of .Capitalized .Static .Members and .lowercase .instance .members, so one
cannot reliably deduce the outcome based on the case of the character after
the dot.

On Thu, Dec 17, 2015 at 9:27 PM, Matthew Johnson via swift-evolution <
swift-evolution at swift.org> wrote:

> anArray.map{$0.anInstanceMethod()}
>
> becomes:
>
> anArray.map(.anInstanceMethod())
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151219/ea6fc7e1/attachment.html>


More information about the swift-evolution mailing list