Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 09 04:00
    notyy commented #222
  • Oct 09 03:59
    notyy closed #222
  • Oct 09 03:59
    notyy commented #222
  • Oct 08 20:28
    Atry commented #223
  • Oct 08 20:28

    Atry on master

    docs: fix typo Merge pull request #223 from Ja… (compare)

  • Oct 08 20:28
    Atry closed #223
  • Oct 08 20:20
    Jason-Cooke opened #223
  • Oct 07 03:30
    glmars commented #222
  • Oct 06 04:05
    notyy opened #222
  • Oct 04 11:29
    datalchemist commented #217
  • Oct 04 11:02
    datalchemist commented #217
  • Oct 04 06:58

    Atry on scalafmt

    (compare)

  • Oct 04 06:46

    Atry on master

    Run scalafmt Merge branch 'master' into scal… Merge pull request #221 from Th… (compare)

  • Oct 04 06:46
    Atry closed #221
  • Oct 04 06:46
    Atry synchronize #221
  • Oct 04 06:46

    Atry on scalafmt

    Update scalafmt to 2.0.1 Update sbt to 1.3.2 Merge pull request #215 from sc… and 2 more (compare)

  • Oct 04 06:06
    Atry commented #217
  • Oct 04 05:30
    glmars commented #217
  • Oct 04 05:09
    Atry closed #191
  • Oct 04 05:09

    Atry on master

    Update scalafmt to 2.0.1 Merge pull request #203 from sc… (compare)

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
Leonid Turnaev
@glmars
Hi @Atry, could you publish new release with ThoughtWorksInc/Binding.scala#90 and ThoughtWorksInc/Binding.scala#104 included?
杨博 (Yang Bo)
@Atry
Sure
Leonid Turnaev
@glmars
Thanks ;)
杨博 (Yang Bo)
@Atry
@glmars It seems that CI is broken due to absence of Oracle JDK
Leonid Turnaev
@glmars
Yeah I saw. Looks like your latest commit have fixed this! :+1:
Leonid Turnaev
@glmars
You have done a big code cleaning yesterday! :thumbsup: :star2: :smile:
Leonid Turnaev
@glmars
Binding.scala 11.2.0 already in Maven Central! :tada:
Wojtek Pituła
@Krever
Hey, sorry for asking here, but my question probably doesn't fit stack overflow either. Is there any up-to-date example/starter for binding.scala with scalajs-bundler/webpack? Or should I just try to assemble it from scratch?
Leonid Turnaev
@glmars
Unfortunately, I don't know such examples, but this should be easy! There is no something special with scalajs-bundler and Binding.scala. Binding.scala is regular Scala.js library.
Wojtek Pituła
@Krever
I see now, I got one working byt adjusting slinky starter. It was easy, but having something out of the box would be nice from increasing adoption perspective. Nevertheless I find Binding.scala an extremely nice project :)
Btw should I consider some state manager like diode/redux or this is not needed with Binding.scala ?
Leonid Turnaev
@glmars
Binding.scala works well without it
Pascal Mengelt
@pme123
@Krever I wrote once a blog about Binding.scala with Redux - see https://pme123.github.io/scala-adapters/development/binding-scala-redux/
Wojtek Pituła
@Krever
@pme123 thanks, will checki it out
Wojtek Pituła
@Krever
There is no explicit map or flatMap for Bindings, but one can use scalaz for that, right?
Wojtek Pituła
@Krever

thanks. Another thing,: how this should be expressed correctly:

class ProcessDefsSelect(allDefs: BindingSeq[ProcessDefinition], selected: Var[Option[ProcessDefinition]]) {

  @dom
  def render: Binding[html.Select] = {
    <select class="ui dropdown" onchange={e: Event => selected.value = allDefs.bind.find(_.id == e.target.asInstanceOf[html.Select].value)} >
      {for (pDef <- allDefs) yield {
      <option value={pDef.id} selected={selected.bind.exists(_.id == pDef.id)} >
        {pDef.name}
      </option>
    }}
    </select>
  }

}

simple select component. This impl doesnt work due to allDefs.bind invoked in callback function...

Wojtek Pituła
@Krever
assigning allDefs.bind to variable outside callback function works fine