Skip to content

Conversation

@seriyvolk83
Copy link

The PR should summarize what was changed and why. Here are some questions to
help you if you're not sure:

mlilback added a commit to mlilback/SwiftyJSON that referenced this pull request Nov 7, 2020
}

#if os(Linux)
#else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives an impression that Linux platform is not finished.

I would prefer more explicit unary not comparison here.

#if !os(Linux)
#endif

@wongzigii
Copy link
Member

Hey @seriyvolk83 I've just noticed your PR, any reason for rolling back the fix?

@seriyvolk83
Copy link
Author

seriyvolk83 commented Feb 21, 2021

Hey @seriyvolk83 I've just noticed your PR, any reason for rolling back the fix?

I don’t remember, but seems the first commit has change that is excessive because on Linux the method are already implemented, no need to add ‘.<‘ like methods. The only change is needed is to have ‘#if’ condition to skip definitions that are presented on Linux. It should compile on both platforms.

@seriyvolk83
Copy link
Author

Btw, #1088 is wrong fix, these mew methods will never be used. Linux has these methods implemented and it’s the reason the code is not complied.

@drewmccormack
Copy link

What is the status of this?

@LinusGeffarth
Copy link

any update on this?

@joshmossas
Copy link

joshmossas commented Aug 10, 2024

Hey y'all couldn't we just replace the failing operator overrides with standard functions?

Example:

Change this

func < (lhs: NSNumber, rhs: NSNumber) -> Bool {
    switch (lhs.isBool, rhs.isBool) {
    case (false, true): return false
    case (true, false): return false
    default:            return lhs.compare(rhs) == .orderedAscending
    }
}

To this

func lt(lhs: NSNumber, rhs: NSNumber) -> Bool {
    switch (lhs.isBool, rhs.isBool) {
    case (false, true): return false
    case (true, false): return false
    default:            return lhs.compare(rhs) == .orderedAscending
    }
}

And then any time we compare two NSNumber instances we use that function instead of <

We would just need to do that for any of those places where the compiler fails in linux land.

@joshmossas
Copy link

joshmossas commented Aug 10, 2024

I bring this up cuz I'm currently working on a cross platform client library for Swift and this is how I got around this issue.

Willing to make a PR if this approach looks good to y'all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants