[swift-evolution] [Review] SE-0023 API Design Guidelines (when to use properties)

Howard Lovatt howard.lovatt at gmail.com
Wed Jan 27 22:44:24 CST 2016


Yes. Better wording would be no externally visible mutation.

On Thursday, 28 January 2016, David Waite <david at alkaline-solutions.com>
wrote:

>
> > On Jan 27, 2016, at 1:56 PM, Howard Lovatt <howard.lovatt at gmail.com
> <javascript:;>> wrote:
> >
> > I would say that if it doesn't have arguments and doesn't mutate then it
> should be a property, since it will read better and is flexible (you can
> switch between a stored and calculated property without affecting the
> external interface easily).
>
> It can mutate as long as the mutation is not externally visible on that
> interface. An example of this would be if the implementation of Set were
> internally backed by a Splay Tree, where balancing of the tree happens on
> every access.
>
> https://en.wikipedia.org/wiki/Splay_tree
>
> Another example is any computed property ever which output logging.
>
> -DW
>
>

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


More information about the swift-evolution mailing list