-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch definitions from lazy vals to vals? #86
Labels
Comments
Scala DOM Types now leaves this choice to the library starting with 17.x, so I am marking this issue as discussion only, there's nothing actionable in SDT. If you try any approaches that aren't |
Actually I'm just gonna move my issue content into #53 and close this as (near-)duplicate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scala.js 1.11 (news) now removes unused fields.
If I understand correctly, this means that we can have e.g.
val div = htmlTag("div")
instead of it being a lazy val, and if you never use div-s in your app, div won't be included in the JS bundle, similar to how it works today with lazy vals.This would be great for us because having a hundred lazy vals for all the tags and properties that you use obviously comes with some overhead, and even if it's not really noticeable, it would be great to simplify.
However, we need to test whether the Scala.js optimizer is smart enough to recognize our implementations of
def htmlTag
as "pure", and thus removable, otherwise we won't win anything. For Laminar the implementation instantiates aclass HtmlTag
which inherits from a trait with two public val-s, the constructor doesn't do anything else other than set those vals. For Outwatch and other consuming libraries, I'm not sure, but I suspect it's something similar. I'm hoping all our implementations are pure enough.The text was updated successfully, but these errors were encountered: