[swift-evolution] JSONEncoder: Key strategies

Brent Royal-Gordon brent at architechies.com
Thu Nov 9 07:57:43 CST 2017


> On Nov 6, 2017, at 12:54 PM, Tony Parker via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Converting from camel case to snake case:
> 
> 1. Splits words at the boundary of lower-case to upper-case
> 2. Inserts `_` between words
> 3. Lowercases the entire string
> 4. Preserves starting and ending `_`.
> 
> For example, `oneTwoThree` becomes `one_two_three`. `_oneTwoThree_` becomes `_one_two_three_`.

My first thought was "are you handling `valueAsHTML` correctly?", but it looks like you are with the "boundary of lower-case to upper-case" wording. But what do you plan to do for numbers? Characters in caseless scripts? Emoji (which are valid in Swift identifiers)? I don't necessarily have strong opinions about the right answer—just want to make sure you do *something* about it.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171109/90f6a402/attachment.html>


More information about the swift-evolution mailing list