Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

am-kantox
Copy link
Contributor

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

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
Copy link
Member

sobolevn commented Feb 18, 2019

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