Starting from line 113 of Policy.swift is this code snippet (with documentation omitted):
#if _runtime(_ObjC)
public typealias AnyObject = Builtin.AnyObject
#else
public typealias AnyObject = Builtin.AnyObject
#endif
It seems to me that public typealias AnyObject = Builtin.AnyObject gets compiled either way, so why is it in a conditional compilation block?
jrose
(Jordan Rose)
2
I suspect this dates from way back when we were just getting Linux support up and running, and still wanted to differentiate Builtin.AnyObject from Builtin.NativeObject (which is known not to be a tagged pointer and thus is a bit more efficient in certain scenarios). These days the compiler knows to treat AnyObject like NativeObject when using a non-ObjC runtime, so we might as well remove the #if.
1 Like
I think the duplicate typealias is still needed:
1 Like
jrose
(Jordan Rose)
4
Oh, bah, that makes sense. Guess I should have looked at the history instead of guessing!
3 Likes