arnetheduck / nph

An opinionated code formatter for Nim
Other
77 stars 12 forks source link

Remove nim 2.0.0 restriction #29

Closed Doaxan closed 5 months ago

Doaxan commented 5 months ago

Hello! Thanks for nph! Is it possible to remove the restriction on nim 2.0.0 since it compiles without problems at the moment, or could it interfere in the future?

arnetheduck commented 5 months ago

Allowing different versions here would run the same risk as using different versions of nph - two users using the same version of nph compiled by different versions of nim would cause it to accept different sets of code, which is an unwanted.

The proper solution here is to call an external nim process of whatever version of nim that the user is using to compile their project and compare outcomes - for that to work, one would need nim itself to have the ability to output a structured version of the AST, something nim cannot do today.

Failing the above, one could compare the lexer&parser in nim 2.0.2 with 2.0.0 and add it to the "supported" set of nim backends explicitly, if (and only of) there are no differences in those parts of the code.

arnetheduck commented 5 months ago

https://github.com/arnetheduck/nph/pull/30 adds 2.0.2 to the list of supported versions, simply because it has no parser changes, which is what works for the present way that nph works