[swift-evolution] Problems with generics - should be fixed for	Xcode 9?
    Joanna Carter 
    joanna at carterconsulting.org.uk
       
    Sat Sep 16 08:32:09 CDT 2017
    
    
  
Greetings
Old chestnut, sort of partially solved but still problems.
Now we can nest types in generic types, what I want is :
class Event<typeT>
{
  class Args
  {
    public static let empty = Args() // error : Static stored properties not supported in generic types
  }
}
But the static let is not directly in the generic class.
So, I end up doing another convoluted workaround in the shape of :
class Event<typeT>
{
  class Args
  {
    public static var empty: Args
    {
      return Args()
    }
  }
}
The main difference is that I have to create a new instance on every call to Args.empty instead of returning the same one.
Is this an oversight or as intended, with the hope of fixing it in a future version
Joanna
--
Joanna Carter
Carter Consulting
    
    
More information about the swift-evolution
mailing list