playframework / twirl

Twirl is Play's default template engine
Apache License 2.0
545 stars 108 forks source link

Support for more than 22 arguments in the twirl template #722

Closed JamesWilson3 closed 6 months ago

JamesWilson3 commented 9 months ago

Hi @mkurz,

I read that Scala 3 has now removed the restrictions regarding the 22 parameter limits (https://docs.scala-lang.org/scala3/reference/dropped-features/limit22.html)

I have also upgraded to using Play 3 with the Scala 3, but I am still encountering the error (when trying to have 23 arguments in the template):

play.sbt.PlayExceptions$CompilationException: Compilation error[type Template23 is not a member of play.twirl.api

Just wondering whether the removal of the 22 parameters limit in Scala 3 has any bearing on the 22 parameter limitations in the template, and if there are any additional changes that needs to be done to make the template support for greater than 22 parameters.

mkurz commented 9 months ago

Might be possible that twirl tries to detect how many args are given and based on this is generates the scala files, not sure, just looking at https://github.com/playframework/twirl/blob/main/api/shared/src/main/scala/play/twirl/api/Template.scala So it looks like twirl needs to be fixed to support Scala 3 removal of the 22 parameter limit? Would you want to work on this and provide a PR?

JamesWilson3 commented 9 months ago

Hi Matthias,

Thank you for your prompt reply. Sadly, I don't know much about Scala, and unfortunately, I won't be able to invest the time required to study it in-depth due to my current commitments. I have been using Java Play Framework instead of the Scala's version for this exact reason. My knowledge about scala pretty much limits to the basic use of the Twirl template.

mkurz commented 9 months ago

If you use Play Java, then just stay on Scala 2.13 for now. If you don't have any Scala code in your project it will make absolutely no difference for you which Scala version you use. And then just watch this issue until it gets resolved 😉

mkurz commented 6 months ago

So I couldn't resist and came up with

as experiment to see if that works.

mkurz commented 6 months ago