JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.44k stars 5.46k forks source link

move Regex into a stdlib #38300

Open StefanKarpinski opened 3 years ago

StefanKarpinski commented 3 years ago

This is a Julia 2.0 issue and definitely cannot be done in Julia 1.x. It would be good to move Regex functionality into a stdlib. This would allow not including PCRE (or whatever regex implementation we're using at that point) in an application image if regexes aren't used at all in the program.

JeffBezanson commented 3 years ago

Totally agree, but this is complicated by the use of regexes in several places in Base: path, methodshow, version, binaryplatforms, show, env, irrationals, even libc.

StefanKarpinski commented 3 years ago

True — the biggest piece of work would be replacing all uses of regexes in Base.

DilumAluthge commented 3 years ago

I wonder if something similar could be done here as was done for TOML.

There is a very minimal implementation of a read-only TOML parser located in the Base.TOML submodule.

Then there is a fully-featured TOML reader and writer located in the TOML stdlib.

Would be make sense to do the same thing here?

Put some very minimal regex functionality into a Base.Regex submodule, just enough to handle the use cases that Jeff listed above.

And then put the full Regex library into the Regex stdlib.

The two could use completely different implementations. E.g. maybe the Regex stdlib uses the PCRE library, but the minimal Base.Regex submodule uses something different and more lightweight.

StefanKarpinski commented 3 years ago

What's the relevance of that link, @apparluk?

StefanKarpinski commented 3 years ago

That's not really what this issue is about.

N5N3 commented 2 years ago

Sorry for the noise caused by my mis-operation.