Swifter icon indicating copy to clipboard operation
Swifter copied to clipboard

'Swifter' used both as module name and class name is problematic. This breaks debugging

Open steipete opened this issue 3 years ago • 1 comments

Basically, this breaks debugging and library evolution (doesn't compile because of a name conflict)

Printing description of json:
expression produced error: error: /var/folders/80/mpcqcbzn44g0p4mrp671cg1h0000gn/T/expr58-4c5dd5..swift:1:73: error: 'JSON' is not a member type of class 'Swifter.Swifter'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swifter.JSON>(bitPattern: 0x1063c56c0)!.pointee)
                                                                ~~~~~~~ ^

Swifter.Swifter:1:14: note: 'Swifter' declared here
public class Swifter {
             ^

This is a big API-breaking change, so I know that this is trouble. I've renamed Swifter to SwifterAPI in my fork to fix this. There's a Swift library evolution issue to fix this eventually (so ::Swifter could be used to differ between module and class), but that's a long-term solution.

steipete avatar Apr 17 '21 11:04 steipete

I'm also affected, though in a bit different way. I have Credential struct in my app and Swift cannot disambiguate between my MyApp.Credential and Swifter.Credential because Swifter is both class name and module name.

alex-vasenin avatar Sep 30 '21 07:09 alex-vasenin