nicklockwood / Expression

A cross-platform Swift library for evaluating mathematical expressions at runtime
MIT License
829 stars 51 forks source link

Minor changes to allow use on Linux #15

Closed carter-thaxton closed 6 years ago

carter-thaxton commented 6 years ago

Great library! I made a few changes to allow use on Linux.

I haven't ever run into the race condition that the objc_sync functions are intended to avoid. The objc runtime isn't available on Linux, so this would require a different method to synchronize on that platform.

The lack of seamless bridging to NSString is one of the more polluting differences on Swift for Linux at the moment. Hopefully that restriction will be lifted in a forthcoming release. In any case, if you're running on Linux, you're probably not using a lot of Any expressions that would use NSString anyway.

Not sure why, but the import Dispatch is explicitly needed on Linux. It's apparently not in CoreFoundation. The import causes no harm on macOS or iOS.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 3ffb948c05ad506d9428d7dbff4fb94a3be43e97 on carter-thaxton:linux into bc4a5dffb880bf5fdb6c7c5f5e7b8101509770fb on nicklockwood:master.

nicklockwood commented 6 years ago

This is awesome, thank you!

I've been meaning to check Linux compatibility, but I don't have a test machine set up to do so.