[swift-evolution] [Discussion] Enum Leading Dot Prefixes

Howard Lovatt howard.lovatt at gmail.com
Sun Feb 14 16:24:31 CST 2016


+1 for the proposal, it is wierd to use `.` in some places and not others.

On the subject of static methods and properties in general, would it be
possible for `.name` to be a reference to a static and `name` a reference
to an instance? EG:

    .name = x // static
    name = x // instance
    x = name + .name // instance + static
    r = name ... .name // instance ... static, needs space
    r = name...Type.name // Can still qualify with type name

On Friday, 12 February 2016, Chris Lattner via swift-evolution <
swift-evolution at swift.org> wrote:

>
> On Feb 11, 2016, at 7:17 PM, Rob Mayoff via swift-evolution <
> swift-evolution at swift.org
> <javascript:_e(%7B%7D,'cvml','swift-evolution at swift.org');>> wrote:
>
> On Thu, Feb 11, 2016 at 9:00 PM, Erica Sadun via swift-evolution <
> swift-evolution at swift.org
> <javascript:_e(%7B%7D,'cvml','swift-evolution at swift.org');>> wrote:
>
>> Unlike static members in structures and classes, enumeration cases can be
>> mentioned in initializers and instance methods without referencing a fully
>> qualified type.
>>
>
> Why not go the other way then and allow instance methods to refer to
> static members (or class members) directly, without the type name prefix?
>
>
> As Erica says, this is a worthwhile topic to discuss, but orthogonal from
> the proposal.  Among other things we’d have to have a way to resolve the
> conflict that comes up when you have both a static and instance method with
> the same name (this occurs a few places in ObjC APIs).
>
> -Chris
>
>

-- 
-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160215/d8917538/attachment.html>


More information about the swift-evolution mailing list