<commit_before># Demangle Function

* Proposal: [SE-0262](0262-demangle.md)
* Author: [<NAME>](https://github.com/Azoy)
* Review Manager: [Joe Groff](https://github.com/jckarter)
* Status: **Scheduled for review (July 22...July 29, 2019)**
* Implementation: [apple/swift#25314](https://github.com/apple/swift/pull/25314)

## Introduction

Introduce a new standard library function, `demangle`, that takes a mangled Swift symbol, like `$sSS7cStringSSSPys4Int8VG_tcfC`, and output the human readable Swift symbol, like `Swift.String.init(cString: Swift.UnsafePointer<Swift.Int8>) -> Swift.String`.

Swift-evolution thread: [Demangle Function](https://forums.swift.org/t/demangle-function/25416)

## Motivation

Currently in Swift, if a user is given an unreadable mangled symbol, they're most likely to use the `swift-demangle` tool to get the demangled version. However, this is a little awkward when you want to demangle a symbol in-process in Swift. One could create a new `Process` from Foundation and set it up to launch a new process within the process to use `swift-demangle`, but the standard library can do better and easier. 

## Proposed solution

The standard library will add the following 3 new functions.

```swift<commit_msg>start review for SE-0262<commit_after># Demangle Function

* Proposal: [SE-0262](0262-demangle.md)
* Author: [<NAME>](https://github.com/Azoy)
* Review Manager: [<NAME>](https://github.com/jckarter)
* Status: **Active Review (July 22...July 29, 2019)**
* Implementation: [apple/swift#25314](https://github.com/apple/swift/pull/25314)

## Introduction

Introduce a new standard library function, `demangle`, that takes a mangled Swift symbol, like `$sSS7cStringSSSPys4Int8VG_tcfC`, and output the human readable Swift symbol, like `Swift.String.init(cString: Swift.UnsafePointer<Swift.Int8>) -> Swift.String`.

Swift-evolution thread: [Demangle Function](https://forums.swift.org/t/demangle-function/25416)

## Motivation

Currently in Swift, if a user is given an unreadable mangled symbol, they're most likely to use the `swift-demangle` tool to get the demangled version. However, this is a little awkward when you want to demangle a symbol in-process in Swift. One could create a new `Process` from Foundation and set it up to launch a new process within the process to use `swift-demangle`, but the standard library can do better and easier. 

## Proposed solution

The standard library will add the following 3 new functions.

```swift
{'fraction_non_alphanumeric': 0.10770471964501815, 'fraction_numerical': 0.03065752319483663, 'mean_word_length': 5.093366093366093, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5739304', 'n_tokens_mistral': 818, 'n_tokens_neox': 715, 'n_words': 278}