You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Niklas Matthies <ml...@nmhq.net> on 2009/07/24 01:59:13 UTC

Version Pattern Matcher

The new Version Pattern Matcher effectively provides a macro-like
functionality for version constraints. This macro facility would be
useful regardless of the version constraint syntax, it could "wrap"
any of the other version matchers (or even itself).

In fact, aren't version matchers and pattern matchers conceptually the
same? Both represent predicates on strings, right? So it would make
sense to give version matchers identifiers (typedefs) so they can play
the role of pattern matchers, like "regexp" etc.

Changing the "pattern-vm" syntax slightly to emphasize the macro
functionality, one could for example have:

    <version-matcher-macros>
        <macro name="atMost" args="max"
               expansion="(,max]" matcher="range" />
    </version-matcher-macros>

And use it like:

    <dependency org="acme" name="tool" rev="atMost(3.0)" />

The example assumes that the Version Range Matcher is available as a
pattern matcher via the typedef "range".

What do you think?

-- Niklas Matthies

Re: Version Pattern Matcher

Posted by Niklas Matthies <ml...@nmhq.net>.
On Fri 2009-07-24 at 01:59h, Niklas Matthies wrote on ivy-user:
> The new Version Pattern Matcher effectively provides a macro-like
> functionality for version constraints. This macro facility would be
> useful regardless of the version constraint syntax, it could "wrap"
> any of the other version matchers (or even itself).
> 
> In fact, aren't version matchers and pattern matchers conceptually the
> same? Both represent predicates on strings, right? So it would make
> sense to give version matchers identifiers (typedefs) so they can play
> the role of pattern matchers, like "regexp" etc.
> 
> Changing the "pattern-vm" syntax slightly to emphasize the macro
> functionality, one could for example have:
> 
>     <version-matcher-macros>
>         <macro name="atMost" args="max"
>                expansion="(,max]" matcher="range" />

This should have been expansion="(,${max}]", of course.

>     </version-matcher-macros>
> 
> And use it like:
> 
>     <dependency org="acme" name="tool" rev="atMost(3.0)" />
> 
> The example assumes that the Version Range Matcher is available as a
> pattern matcher via the typedef "range".
> 
> What do you think?
> 
> -- Niklas Matthies

-- Niklas Matthies