[swift-evolution] [Oversight] Reference types allow mutating methods through generics

David Sweeris davesweeris at mac.com
Thu May 5 11:34:32 CDT 2016


> On May 5, 2016, at 10:59 AM, Dave Abrahams <dabrahams at apple.com> wrote:
> 
> 
> on Wed May 04 2016, Matthew Johnson <matthew-AT-anandabits.com> wrote:
> 
>>> On May 4, 2016, at 4:16 PM, David Sweeris <davesweeris at mac.com> wrote:
>>> 
>>> Having given it some more thought... Does "PureReference" make
>>> sense? What would it mean? At some point a reference has to, you
>>> know, actually refer to a concrete value. Otherwise it's just
>>> turtles all the way down.
>> 
>> In my thinking PureReference (or ImmutableObject) has semantics
>> indicating that the type is a value-semantic reference type.  I think
>> this could be quite useful in some cases.
> 
> Like what? To a first approximation, the only thing I can see this being
> useful for is Objective-C interop.  Aside from being an element of an
> NSArray, there's nothing a an immutable class can do that a struct
> can’t.
Generic “manager” singletons? Like maybe if you wanted to use something other than NSFileManager? I’m hazy enough on exactly what the singleton pattern means that I’m not sure it matters.

- Dave Sweeris


More information about the swift-evolution mailing list