Thanks to visit codestin.com
Credit goes to github.com

Skip to content

convert filters to more modern versions of OTP #260

@brigadier

Description

@brigadier

At the moment there's a lot of inefficient code in the erlydtl_filters. All operations on binaries are done through converting data to unicode lists first because before OTP 17 (or R16B, I don't remember) there were no binary_to_integer and similar functions.

Another thing to look at is the 'string' module in OTP 21 - now filters such as title work incorrectly with non-latin strings because string:to_lower/to_upper won't work with unicode at all. There are new unicode-aware functions in the string since OTP 21, though I'm not sure about how does their efficiency look when compared to the current implementation. But at least they work with unicode.

To begin with something I'd like to ask your opinion on how we should deal with compatibility with earlier OTP versions. The options I can think of: (1) call erlang:system_info(otp_release) on each call; (2) quit supporting old versions of OTP (OTP 20 and older) at all; (3) let people define in macros which version they want to support and check this macros in compile time. The macros can be configured in rebar.config - something like this{erl_opts, [debug_info, {d, 'ERLYDTL_OTP17COMPAT'}]}.; (4) Some exotic such as automatically replacing functions in compile time with a parse_transform.. Maybe there are other options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions