Proposal: Path.match?/3

29 views
Skip to first unread message

Jon Leighton

unread,
Oct 3, 2021, 2:27:30 AM10/3/21
to elixir-lang-core

Hi there,

I have published a new library called path_glob: https://github.com/jonleighton/path_glob

It aims to implement glob matching without touching the filesystem. That is, if a path is returned by Path.wildcard(glob, opts), then PathGlob.match?(path, glob, opts) should return true. This is much more performant in cases where we have a single path to check against a glob, and the glob would result in a lot of filesystem traversal.

I wonder whether this would be a candidate for inclusion into core Elixir? It seems that it might be generally useful and it complements the functionality already provided by Path.wildcard/2.

The parser is implemented with nimble_parsec. I presume that if it were included into Elixir core then we wouldn't want that dependency, but we could check in the generated parser source to avoid it.

Cheers,
Jon

José Valim

unread,
Oct 3, 2021, 2:47:45 AM10/3/21
to elixir-l...@googlegroups.com
This would be a welcome addition. However, notice that our wildcard implementation simply relies on Erlang's filelib:wildcard/2. So the first path would be to add filelib:match/2 to Erlang. Feel free to ping me on IRC if you need help or guidance to get this started on the Erlang side.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/573439f2-7de7-458c-94bf-0b33eba666bdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages