[Accepted with Modifications] SE-0246: Generic Math Functions

Yes. There are some issues that were exposed with type checker performance and source stability that caused us to move it out of 5.1. Specifically:

  • we cannot easily eliminate the existing concrete functions in the Glibc/Darwin/etc modules because of source and binary stability concerns. These have the same names as many of the new functions, which causes some type checker regressions. Most of these regressions are small, but there are some bad cases that we haven't have time to address yet.

  • there's a type checker bug involving overload resolution; static member functions are always preferred to free functions, which means that existing code like:

    extension Double {
      func foo() -> Double {
        log10(self)
      }
    }
    

    would fail to compile (because the static log10 cannot be used without calling it as Double.log10, but is still preferred in name lookup, so the type checker doesn't find the existing free function). This is a bug, but we can't land the change until it is fixed, and we didn't have time to do so for 5.1.

Once we get the necessary type checker improvements to unblock these changes, I'll re-propose them.

14 Likes