> On Oct 27, 2016, at 6:54 AM, swizzlr via swift-dev <swift-dev@swift.org> 
> wrote:
> 
> Swift Foundation has an incomplete implementation of 
> NSClassFromString/NSStringFromClass (link: 
> https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSObjCRuntime.swift#L230-L282)
>  due to a lack of a standardised method of encoding nested Swift classes, nor 
> other Swift types.
> 
> I would think that given
> 
> module Contacts
> 
> class Person {
>       struct Address {
>               class Postcode {}
>       }
> }
> 
> Postcode would be encoded as Contacts.Person.Address.Postcode. Since it is 
> not possible to have two different types with the same identifier in the same 
> namespace (i.e. an enum/a class/a struct with the same name at the same 
> declaration level) the encoding would similarly be simple. May I proceed 
> under that assumption or are there ABI stability issues I have yet to 
> consider?

Yeah, that eventually ought to work. We're in the middle of setting up the 
layout of Swift metadata to make this kind of dynamic lookup easier to support.

-Joe
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to