Skip to content

C API for URLPattern #877

Description

@bungle

What is the problem this feature will solve?

Is it possible to add C API for the recently added URLPattern?

What is the feature you are proposing to solve the problem?

It is in general a bit easier to interface with C API from other languages.

What alternatives have you considered?

Not yet any.

Activity

  1. anonrig commented on Feb 13, 2025

    @anonrig
    Member

    I'm not sure what is the correct approach to add a C API and also use a template argument for the regex engine.

  2. bbayles commented on Feb 13, 2025

    @bbayles

    I think you would add declarations for specific instances of the template function, right?

    Once there are C bindings I can add Python calls for ada-python.

  3. lemire commented on Feb 13, 2025

    @lemire
    Member

    @bbayles The challenge is that we do not provide the regular expression engine. The user must provide it.

    Our implementation of URLPattern is not self-sufficient. It provides everything but the regex engine.

    The standard C++ regex engine is a variation on ECMAScript, but not a proper ECMAScript implementation. Furthermore, it is unsafe. See my blog post: https://lemire.me/blog/2025/01/25/regular-expressions-can-blow-up/

    You need a regex engine that supports the full ECMAScript regex specification in a safe manner. We do not have that in the library. So when Node.js uses URLPattern, they provide the regex engine.

    I think you would add declarations for specific instances of the template function, right?

    Yes, given a proper regex engine, which we do not have.

  4. pinned this issue on Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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