These are chat archives for ThoughtWorksInc/Binding.scala

6th
Mar 2017
Cause Chung
@cuzfrog
Mar 06 2017 02:32

@Atry makeIntellijHappy is under documented.

  1. it lacks generics.
  2. package object may be a better and larger scope.
  3. it should throw an AssertionError.

    It could be like this:

package object xxx {
  implicit def makeIntellijHappy[T<:org.scalajs.dom.raw.Node](x: scala.xml.Node): Binding[T] =
    throw new AssertionError("This should never execute.")
}
杨博 (Yang Bo)
@Atry
Mar 06 2017 02:50
@cuzfrog You are right. Since we are moving FAQ to Stackoverflow(ThoughtWorksInc/Binding.scala#47), would you mind creating a question and answer there with your better solution?
Cause Chung
@cuzfrog
Mar 06 2017 02:51
@Atry Pleasure.
杨博 (Yang Bo)
@Atry
Mar 06 2017 02:52
@cuzfrog :smile:
Cause Chung
@cuzfrog
Mar 06 2017 03:55

@Atry wildcard in generics not supported?

trait Element[T]{val value:Var[T]}
case class TextInput(value: Var[String]) extends Element[String]

@dom def polymorph(e: Element[_]): Binding[Div] =
    <div>
      {e match {
      case t: TextInput => t.value.bind
    }}
    </div>

compiler complains about type mis-match

杨博 (Yang Bo)
@Atry
Mar 06 2017 03:56
@cuzfrog Could you ask the question on StackOverflow in the form of https://stackoverflow.com/help/how-to-ask ?
Cause Chung
@cuzfrog
Mar 06 2017 03:57
@Atry Ok
杨博 (Yang Bo)
@Atry
Mar 06 2017 03:57
Nice