Re: [swift-evolution] [discussion] Class stored properties?

2017-08-09 Thread Christopher Kornher via swift-evolution
Class variables are not common, but they are the most natural way to implement class-specific functionality. Off the top of my head, I have used class variables for: 1) Custom allocation schemes, e.g. pools, LRU implementations 2) Diagnostics, e.g. counting the number of instances of a given cla

Re: [swift-evolution] [discussion] Class stored properties?

2017-08-09 Thread Mathew Huusko V via swift-evolution
I don't follow. What's a singleton/how? If you mean my example, the whole point/need for the feature is so it's not. I want `.value` to be unique storage for each subclass. On Wed, Aug 9, 2017 at 7:09 PM, Robert Widmann wrote: > This is a singleton, it just happens to be in class scope. > > ~Rob

Re: [swift-evolution] [discussion] Class stored properties?

2017-08-09 Thread Robert Widmann via swift-evolution
This is a singleton, it just happens to be in class scope. ~Robert Widmann > On Aug 9, 2017, at 3:55 AM, Mathew Huusko V via swift-evolution > wrote: > > Curious if class stored properties have ever been discussed (doesn't seem > so..)? > > Also, assuming no, and assuming there's a good reas

Re: [swift-evolution] [discussion] Class stored properties?

2017-08-09 Thread Charlie Monroe via swift-evolution
It's common for a class to return a value (class var), but setting it on a per-class basis IMHO isn't *that* common. But maybe I'm mistaken. > On Aug 9, 2017, at 1:09 PM, Mathew Huusko V wrote: > > My use case is an abstract class. In Objective-C I used associated values on > the dynamic class

Re: [swift-evolution] [discussion] Class stored properties?

2017-08-09 Thread Charlie Monroe via swift-evolution
Hi, can you provide a usecase for this? I remember this being used in ObjC for +version, but I'm not sure anymore where I'd use this... BTW you don't need to stringify, use ObjectIdentifier (part of stdlib). > On Aug 9, 2017, at 12:54 PM, Mathew Huusko V via swift-evolution > wrote: > > Curi