Over on the Crash backtraces thread, there's some discussion using Swift's demangler to help pretty up backtraces into a human readable format. Right now the standard library doesn't include a demangle function, but the Swift runtime already includes such function. We can make use of that and incorporate it into the standard library. A naive API for this can look like:
public func demangle(_ mangledName: String) -> String
however, the demangle function offers a bit more functionality we can take advantage of. For example, instead of returning a new string, we could pass a pre-allocated buffer that it could write to:
public func demangle( _ mangledName: String, info buffer: UnsafeMutableBufferPointer<Int8> )
There's an extra flags option that the demangler takes, but right now there currently aren't any flags. If in the future the demangler ever takes optional flags, we could introduce a new overload with a flags parameter. Other ideas for how to accommodate this case would be greatly appreciated.
Would love to hear thoughts and opinions!