com-lihaoyi / scalatags

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

Any reason to still allow unit fragments in scala 3? #249

Open benediktwerner opened 1 year ago

benediktwerner commented 1 year ago

In Scala 3, if without an else always evaluates to Unit. This means code like div(if (cond) h1("a"), ...) now never produces anything, even if the conditions is true, which has lead to a few silent issues when we transitioned to Scala 3 where stuff suddenly wasn't rendered anymore. Are there any other reasons to keep allowing units in templates? If not, it seems better to disallow this now to avoid mistakes like this?

bwbecker commented 7 months ago

Agreed. Just got bit by this myself.