Foundation woes

I have some problems using the Foundation framework with Silver (Elements 9.2) and macOS 10.12. For example:

  1. Attempt to use URL(string:relativeTo:) results in
    No matching overload.

  2. Attempt to use UserDefaults.standard results in
    No such static member.

I also have the following problem:

public enum GzipError: Error {
    case stream(message: String)
}

gives error E62 (Type mismatch, cannot assign "not nullable Foundation.Error" to "Integer"). However, I am not sure whether this has anything to do with Foundation.Error, or if this is just a generic enum issue. Anyway, the code compiles without problems in Xcode.

1 and 2 seem to be yet more name mangling discrepancies. Swift 3 has well-defined rules for how Cocoa names are supposed to be made uglier for sue with Swift, and we follow them, but it seems that some of the mangling Apple does goes further, i’ll need to investigate why these two come thru differently. In the mean time, using the official Cocoa API names should work, eg NSUserDefaults.standardUserDefaults.

The enum thing looks like a bug, will log a compiler issue for that. (that said, if Error is a class, it seems weird that you should be able to descend an enum from it!? and Foundation.(NS)Error is a class.)

thanx,
marc

Thanks, logged as bugs://78472

Thanks, logged as bugs://78473

Lovely that Apple doesn’t;t follow their own rules.

Never prune a suffix from a parameter introducer unless the suffix is immediately preceded by a preposition, verb, or gerund.

yet, they prune UserDefaults which is refined by standard. Last i checked standard is NEITHER a preposition, verb, or gerund. That’s why we don’t rename one :(. Fixed for the next time we import SDKs, by adding a manual exception.

The enum example is from GzipSwift, but it is also what Apple suggests in the Error handling chapter of the Swift documentation.

bugs://78472 got closed with status fixed.

bugs://78473 got closed with status wontfix.