nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.49k stars 1.46k forks source link

Consider migrating from pcre to pcre2 #23668

Open alex65536 opened 4 months ago

alex65536 commented 4 months ago

Description

Nim depends on the obsolete PCRE library, which is no longer supported with last release in 2021, and should migrate to PCRE2 library available since 2015.

I am concerned that Debian wants to remove the deprecated PCRE library (see this bug report), making some of the functionality and some of the Nim packages unusable in the next stable Debian release.

So, please consider porting std/nre and std/re to PCRE2. PCRE and PCRE2 seem to be API incompatible, but it should not be a problem for anyone who doesn't use the C wrappers directly.

Nim Version

Any version at the time of writing (devel branch is affected as of cdfc886f88cc95a8dc05e2211d1030b146a521f5)

Current Output

No response

Expected Output

No response

Possible Solution

No response

Additional Information

No response

ringabout commented 4 months ago

side note: ubuntu 24.04 doesn't seem to ship libpcre3 by default, you have to install pcre manually => https://github.com/nim-lang/Nim/pull/23649

arnetheduck commented 3 months ago

This is an excellent opportunity to deprecate the re module and recommend a library instead, such as https://github.com/nitely/nim-regex (this way the library can be updated without waiting months for a release and getting hit by other unrelated changes)

alex65536 commented 3 months ago

This is an excellent opportunity to deprecate the re module and recommend a library instead

Well, part of Nim depends on regexes itself. I took a quick look over the code base and discovered two such places in Nim itself: nimgrep and tests for nimsuggest. The latter one may be easy to remove, but for nimgrep using regexes is the core functionality, and the Nim repo seems to avoid dependencies on Nimble packages for now.

arnetheduck commented 3 months ago

Nim repo seems to avoid dependencies on Nimble packages for now.

actually it does not - some packages are depended upon and downloaded to a special dist folder to create a "full" source distribution - the same can be done for regex, to create stand-alone compiler code releases.

jmgomez commented 3 months ago

+1 to deprecate it and to use an external package. I don't mind to have it in the std. The issue I see is the lib dep

arnetheduck commented 3 months ago

also, nimgrep could easily be a package - there's literally nothing in there that needs to live in nim proper.

nileshpatra commented 1 month ago

Did you get a chance to work on it? Nim has been out of debian testing for a while by now due to this being a release critical bug for us (pcre3) not being a part of next release.

Araq commented 1 month ago

FWIW I found no migration guide.

nitely commented 2 weeks ago

fwiw, there is this https://github.com/PCRE2Project/pcre2/issues/51#issuecomment-973011802 and the linked PRs as migration examples.