Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 07 10:20
    Atry commented #175
  • Dec 07 10:02
    adrobisch commented #175
  • Dec 01 21:52
    Atry commented #175
  • Dec 01 12:39
    adrobisch commented #175
  • Nov 24 09:02
    adrobisch commented #175
  • Nov 24 05:37
    Atry commented #175
  • Nov 24 03:38
    Atry commented #175
  • Nov 23 21:44
    adrobisch commented #175
  • Nov 23 21:44
    adrobisch commented #175
  • Nov 23 21:42
    adrobisch commented #175
  • Nov 23 17:39
    Atry opened #225
  • Nov 23 17:37
    Atry commented #175
  • Nov 23 12:51
    adrobisch commented #175
  • Nov 23 12:51
    adrobisch commented #175
  • Nov 22 04:33

    Atry on Atry-patch-1

    (compare)

  • Nov 22 04:33

    Atry on master

    Upgrade Scala version Merge pull request #224 from Th… (compare)

  • Nov 22 04:33
    Atry closed #224
  • Nov 22 03:00
    Atry opened #224
  • Nov 22 03:00

    Atry on Atry-patch-1

    Upgrade Scala version (compare)

  • Nov 22 02:59

    Atry on master

    Update sbt-scalajs, scalajs-com… Merge pull request #213 from sc… (compare)

Mustafa Kuscu
@mcku
What if a store has an optional substore? See: https://scalafiddle.io/sf/goKYlDa/0
杨博 (Yang Bo)
@Atry
Check your browser's inspector
Mustafa Kuscu
@mcku
isn't it working?
Kahli Burke
@kahliburke
Check the stackoverflow
Pascal Mengelt
@pme123
@kahliburke thanks - that helps - I updated the ScalaFiddle to see the effect.
Leonid Turnaev
@glmars
@Atry do you have any plans to migrate Binding.scala to Dsl.scala and Cats?
Do I understand correctly what it is possible? How hard is it in you opinion (may be PR can help)?
杨博 (Yang Bo)
@Atry

It could be.

But I did not see enough benifits.

Lorenzo Gabriele
@lolgab
There are ways to get the value of an input (like the inputId.value thing ) for dynamic elements (like a Seq of inputs) ? (The id is not fixed at compile time)
If it is a interesting question I can post it on StackOverflow.
Leonid Turnaev
@glmars
@Atry, to have the single FP library (cats) in projects which uses Binding.scala
杨博 (Yang Bo)
@Atry
@lolgab Go ahead
@glmars Binding.scala uses Scalaz because Each requires scalaz.Monad.
However, Dsl.scala does not depend on Cats nor Scalaz.
Binding.scala does not have to depend on Cats if we replace Each to Dsl.scala
Leonid Turnaev
@glmars
So, there is an additional benefit: reduced scalajs output size (Scalaz isn't so small in JS)! In case if some project still doesn't use any FP library.
杨博 (Yang Bo)
@Atry

(Scalaz isn't so small in JS)

The entire Scalaz is big. Fortunately a typical web application with Binding.scala only uses a very small part of Scalaz. You can open your xxxx-fastopt.js to check it. DCE in Scala.js is very useful.

Leonid Turnaev
@glmars

DCE in Scala.js is very useful

I agree, DSE is cool. But on some project I had 2640/2400 kb result of fullOptJS with/without Scalaz.

I suppose that the influence of Scalaz in Binding.scala can be not so much.
(my test project have not used Binding.scala)
Leonid Turnaev
@glmars

@Atry Unfortunately I found a case where application which uses Binding.scala should depend on Scalaz. Please, see example from FAQ:

@dom def renderList(data: List[Binding[String]]) = <ol>{
  import scalaz.std.list._ // Type classes for List
  for (b <- data) yield {
    <li>{b.bind}</li>
  }
}</ol>

Can Dsl.scala remove this dependency (or change to Cats)?

杨博 (Yang Bo)
@Atry
Of course, because Dsl.scala does not support for-comprehension
Dsl.scala itself can be considered as an alternative to for-comprehension
Leonid Turnaev
@glmars
:smile: O! I understand.
Leonid Turnaev
@glmars

@Atry If you're interested, I have repeated the js-framework-benchmark with different versions of Binding.scala.
Here are results for: Chrome 32-bit and for: Chrome 64-bit (sorry, 3 runs only).

Conclusions and questions:

  • your conclusions about Scala 2.12 was confirmed, memory usage is increased by 22-23%:

glmars-v2.12-memory.png

  • but the absolute values are lower than in your results:

atry-v2.12-memory.png

  • I especially pleases by memory consumption on a 32-bit version of Chrome:

32-bit-memory.png

  • one question only: do you have any guesses why the clear rows time increased in Binding.scala v11.0.1?

clear-rows-increase.png

杨博 (Yang Bo)
@Atry
v11 fixed a bug in v10 when removing a node. The fix to ThoughtWorksInc/Binding.scala#56 performs some internal cache invalidation.
Leonid Turnaev
@glmars
Thank you, I also thought about this task :smile:
杨博 (Yang Bo)
@Atry
There could be an optimization in Scala.js scala-js/scala-js#2675, which should improve both code size and computational performance.
The IIFE can be replaced to a normal code block, considering let and const in ECMAScript 2015 code blocks has the same lifecycle as var in IIFEs.
Leonid Turnaev
@glmars
It will be great!
Thanks for the explanation.
杨博 (Yang Bo)
@Atry
You can create a PR to Scala.js if you're interested to optimize the memory usage in Scala 2.12
When compling a closure to JavaScript
  • Scala.js 2.11 create classes
  • Scala.js 2.12 create nested closures in IIFEs, which consums more memory than classes
  • Ideally, it should create plain closures in code blocks (for ECMAScript 2015 target)
Leonid Turnaev
@glmars
I understand an idea, but I'm not sure I am able to do this (because I don't know Scala.js insides very well) :worried:
杨博 (Yang Bo)
@Atry
Never mind
moritz bust
@busti
I recently had a chat with the folks over at scala/contributors and became aware of the fact that xml mode will be faded out with scala 3.
What will happen with binding.scala when that happens?
杨博 (Yang Bo)
@Atry
@Busti Where is the link of the chat
moritz bust
@busti
@Atry Seems like the discussion is still going on at https://gitter.im/scala/contributors
moritz bust
@busti
Does binding.scala use a compiler plugin to parse the contend of @dom methods differently?
Or does it rely on xml literals?
杨博 (Yang Bo)
@Atry
No. Instead, Binding.scala hacks the AST generated by the Scala parser.
moritz bust
@busti
Does that mean that an attr without a value like <foo bar></foo> is possible?
杨博 (Yang Bo)
@Atry
Are you talking about Scala 3 or the current version of Binding.scala?
moritz bust
@busti
The current version of binding.scala . Since scala xml literals are not sgml literals, the above is not valid xml.
杨博 (Yang Bo)
@Atry
I don't think Scala 2 parser accepts <foo bar></foo>
moritz bust
@busti
I recently tried it on https://astexplorer.net/ and it failed without generating ast for the "malformed" literal.
杨博 (Yang Bo)
@Atry
🤷
moritz bust
@busti
Thanks a lot for your answers :)
杨博 (Yang Bo)
@Atry

@/all Hello, Binding.scala users and contributors,

There is a discussion about the feature of XML literals in Scala 3, in which you guys may be interested.

杨博 (Yang Bo)
@Atry
@/all You may also want to have a look at the proposal of name-based XML literal at https://contributors.scala-lang.org/t/pre-sip-name-based-xml-literals/2175