Skip to content

[opinionated] use Unicode Consortium file to generate guards.#47

Open
am-kantox wants to merge 2 commits into
wemake-services:masterfrom
am-kantox:feature/guards-for-upper-lower
Open

[opinionated] use Unicode Consortium file to generate guards.#47
am-kantox wants to merge 2 commits into
wemake-services:masterfrom
am-kantox:feature/guards-for-upper-lower

Conversation

@am-kantox

Copy link
Copy Markdown

This is a very opinionated approach to eliminate regular expressions at all.

Basically, I have the implementation partially stolen from Elixir core. It parses the Consortium Unicode spec files to produce is_lowercase/1 and is_uppercase/1 guards alongside with casing/1 function returning :upper | :lower | :not_a_letter.

Due to the parsing/clause generation stage, it compiles ≈20secs, but I consider it’s affordable because normally it happens only once per project/environment. Thanks to generated guards, the Recase methods work faster than the generic clause with ~r/\p{Ll}\p{Lu}/ as we had in the previous version.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.7%) to 95.238% when pulling b1db461 on am-kantox:feature/guards-for-upper-lower into aea2153 on sobolevn:master.

@sobolevn

sobolevn commented Feb 18, 2019

Copy link
Copy Markdown
Member

the Recase methods work faster

How much faster?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants