GithubHelp home page GithubHelp logo

Comments (5)

fzhinkin avatar fzhinkin commented on September 22, 2024 1

Related PR: #121

from binary-compatibility-validator.

fzhinkin avatar fzhinkin commented on September 22, 2024

It seems like regular expressions could be too heavyweight (conceptually, not in terms of performance overhead) for this particular problem. Would wildcards (like * and ?, or even ant-style globs with **) solve the problem or are there some practical cases where it's not enough to specify the *?

from binary-compatibility-validator.

martinbonnin avatar martinbonnin commented on September 22, 2024

Would wildcards

Strong opposition to wildcards. Regex has documentation and years of battle tested usage. Most developers should be familiar with Regexes.

Wilcards have different implementations (shell, ant, other?) and it's impossible to tell what to expect without reading through (sometimes absent) documentation.

Plus regexes are more flexible. Sorry for the upfront response but I've been burned too many times 😅

from binary-compatibility-validator.

fzhinkin avatar fzhinkin commented on September 22, 2024

The flexibility regexes have comes with complexity and it's easy to make a mistake. When applied to package names, it may be too cumbersome to escape every dot in the name to get a semantically correct RE.

Wilcards have different implementations (shell, ant, other?) and it's impossible to tell what to expect without reading through (sometimes absent) documentation.

One still has to read documentation to figure out if the expression like ignoredPackages += "\.*\.internal" will match the whole input or only a subsequence.

With wildcards having only * in the grammar, it should be possible to express basic package-related patterns without keeping complex grammar rules in mind. I believe that we are all used to treating * as the Kleene operator, so there should not be that much ambiguity.

From the API point of view, wildcards allow us to continue using the same ignoredPackages property to specify both literal package names and wildcards (let's pretend that there are no packages with * in their names 😨). For regexes, the new API has to be introduced, otherwise, users have to escape all their existing ignoredPackages to preserve the semantics after update.

from binary-compatibility-validator.

martinbonnin avatar martinbonnin commented on September 22, 2024

One question is: "does * match . ?"

If I want to ignore com.foo.internal and all subpackages, do I have to ignore com.foo.internal and com.foo.internal.* (and potentially com.foo.internal.*.*?). Can I just ignore com.foo.internal* (but then it might be surprizing to someone that adds com.foo.internalization?).

I've been there with dexguard and to this day I won't be able to tell you if a dexguard rule matches a class name from memory. I wish all string matching used regexes so that I don't have to fit new rules in my brain.

Now the BCV use case is probably simpler and you're 100% right about new API. Using just ignoredPackages wouldn't work. I have updated the initial comment to use ignoredPackagesRegexes.
So at the end of the day, it's a tradeoff that also depends on personal preferences. Both work for my immediate use case so I'll be happy no matter what :). Thanks for looking into this!

from binary-compatibility-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.