[swift-evolution] [Proposal] Property behaviors

Seán Labastille sean+swift-evolution at lsr.li
Mon Jan 18 16:17:10 CST 2016


@Curt

I apologise for the poorly formatted response as I currently receive the list in digest (a mistake I have learned).

Your use case may be addressed by the __FUNCTION__ literal expression which could be defined as the property’s name when within a behaviour?
This has previously proven useful when defining associated objects, for example: (sel_getName(Selector(__FUNCTION__)))

Regards,

Seán

> It would be very handy to have access to the property's name inside the behavior. As proposed, we have Self and self for referring to the type and instance of the container and newValue for referring to the new value in the core getter. A predefined local variable "name" of type String, bound to the name of the decorated property, would be handy for implementing things like Brent's backedByJSON behavior:




More information about the swift-evolution mailing list