You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I assume that using above scala-cli configuration, all available optimizations are applied to compiling and linking the code.
But no object literal was generated, as stated in the docs. Instead, a pretty complex expression is emitted.
Using an anonymous js.Object instance as in testObj2 comes closer to a native object definition.
Background: Seeing how easy it is to compile scala to js using scala-cli, I was hoping to develop a concise and lightweight DSL with scala.js on top of an audio processing library using a verbose js API, and to use this DSL alongside the rest of a js/ts codebase. But seeing that js.Dynamic.literal - which would be needed a lot - is emitting pretty complex code, i am worrying about too much overhead with such a solution.
The text was updated successfully, but these errors were encountered:
sjrd
changed the title
js.Dynamic.literal does not generate a Javascript object literal (using scala-cli to compile)
js.Dynamic.literal does not generate a JS object literal with Scala 2.13/3.
Sep 17, 2024
I have this Scala file
object-literal.scala
:and compile it using Scala CLI version: 1.4.3:
The relevant generated js output (formatted using prettier):
I assume that using above scala-cli configuration, all available optimizations are applied to compiling and linking the code.
But no object literal was generated, as stated in the docs. Instead, a pretty complex expression is emitted.
Using an anonymous js.Object instance as in
testObj2
comes closer to a native object definition.Background: Seeing how easy it is to compile scala to js using scala-cli, I was hoping to develop a concise and lightweight DSL with scala.js on top of an audio processing library using a verbose js API, and to use this DSL alongside the rest of a js/ts codebase. But seeing that js.Dynamic.literal - which would be needed a lot - is emitting pretty complex code, i am worrying about too much overhead with such a solution.
The text was updated successfully, but these errors were encountered: