#2333 What would be the design pattern for type-safe builders? Any example.

rasa Sat 23 Aug 2014

What would be the design pattern for type-safe builders? See example of what I mean here http://jaxenter.com/type-safe-web-with-kotlin-47395.html.

brian Sat 23 Aug 2014

You do that in Fantom via it-blocks and the comma operator. If you look thru how we build up FWT widget trees you will how it works. Something like:

GridPane
{
  Label { text = "a" },
  Label { text = "b" },
  EdgePane
  {
    left = Label { text = "left" }
  }
}

Although you can use methods that take an it-block to make it look the example you referenced

rasa Sat 23 Aug 2014

Thanks. That's it.

Login or Signup to reply.