com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
757 stars 117 forks source link

docs: make reference to stylesheet `val`s clear #259

Closed ckipp01 closed 1 year ago

ckipp01 commented 1 year ago

In Scala 2 you could use a def to define your clss, but in Scala 3 the implementation is only looking for valDefs in the file, meaning that defs will no longer work. This makes sure the docs don't mention using defs and instead focus the verbiage on vals.

lolgab commented 1 year ago

Do you know if this is an intrinsic limitation of Scala 3 or if it can be fixed? I think the end goal is to have feature parity between Scala 2 and 3

ckipp01 commented 1 year ago

Do you know if this is an intrinsic limitation of Scala 3 or if it can be fixed? I think the end goal is to have feature parity between Scala 2 and 3

To be honest I'm not sure without digging in. I did quickly try to add in a check for DefDefs here:

https://github.com/com-lihaoyi/scalatags/blob/6a93955e5cf8dc204362aecae9ebb5e882f320a6/scalatags/src-3/scalatags/stylesheet/SourceClasses.scala#L15

But then it screwed up the next line so I didn't go further. My guess is that it's totally doable. So if you'd rather hold off on this, I can try to dig into that and actually fix it correctly if that'd be preferable.

lolgab commented 1 year ago

My feeling is more that we should not close the issue if it's an actual issue, instead maybe add more info about what is the actual limitation. This means that we can probably merge this (after removing "Closes #257" from the PR description, so the original issue remains open).

ckipp01 commented 1 year ago

My feeling is more that we should not close the issue if it's an actual issue, instead maybe add more info about what is the actual limitation. This means that we can probably merge this (after removing "Closes #257" from the PR description, so the original issue remains open).

Sure, I put some more info in the issue and I remove the "closed". If I get a bit more free time this week I'll try to dig into a fix.

lolgab commented 1 year ago

Thank you for your contribution @ckipp01 ! :)