[swift-evolution] [Proposal] Property behaviors

Howard Lovatt howard.lovatt at gmail.com
Fri Dec 25 15:14:44 CST 2015


If a Property Behavior is 'officially' defined as a syntax sugar:

    var _name = ...
    var name: Type {
        get { return _name }
        set { _name = ... }
    }

Then allow:

    _name.behaviorMember ...

This is simple to implement, understand, and document. 

Sent from my iPad

> On 24 Dec 2015, at 5:30 PM, David Waite via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There was a proposal as well to get property accessor method access directly, without referencing the function. 
> 
> If you had obj#myProperty.get() -> Val and obj#myProperty.set(_:Val) as functions (# syntax being a placeholder more than a proposal) perhaps then you could also have something like obj#myProperty.clear()
> 
> -DW
> 
>> On Dec 23, 2015, at 10:07 AM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I agree that "myProperty.clear()" is very appealing, but it has the potential to be confusing when behavior methods are shadowed by members of the front-facing property. You'd still need a way to unambiguously refer to behavior methods when they're shadowed too.
>> 
>> -Joe
> 
> 
> _______________________________________________
> 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/20151226/5c0fbd02/attachment.html>


More information about the swift-evolution mailing list