[swift-dev] Swift Class Encoding Standard?

swizzlr me at swizzlr.co
Thu Oct 27 08:54:25 CDT 2016


Swift Foundation has an incomplete implementation of NSClassFromString/NSStringFromClass (link: https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSObjCRuntime.swift#L230-L282 <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?

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161027/041a3b09/attachment.html>


More information about the swift-dev mailing list