j-mie6 / parsley

A fast and modern parser combinator library for Scala
https://j-mie6.github.io/parsley/
BSD 3-Clause "New" or "Revised" License
173 stars 15 forks source link

[Doc]: the limit of 22 generics is not a JVM limitation #242

Closed xsh005 closed 2 months ago

xsh005 commented 3 months ago

Description

Here it's incorrectly mentioned that: The lift functions work all the way up to 22 arguments (which is a JVM limit). It was actually a scala 2 limitation (inherited from early versions of kotlin it seems).

j-mie6 commented 3 months ago

Limit was from the JVM itself (not Kotlin) and it still is a limitation I believe. Scala 3 just side-steps it by packing arguments for 23 and above functions into an array instead. I could remove that now that Scala 3 is more common, however it's good to have a justification for why I stopped at 22 as opposed to going any higher.

xsh005 commented 3 months ago

Hmm, I heard that this limit is just convenient for the scalac compiler? You could write a java function with 23 or more generic parameters.

j-mie6 commented 3 months ago

Hmm, I think you might be right... I wonder where I had heard it was a JVM limit from? Nevertheless, I'll update it to make clear this was a Scala 2 decision (indeed, I still cross-build for Scala 2, so I can't exceed this limit anyhow)