Wednesday, May 30, 2018

Thoughtworks DSL for Scala

I really like Thoughtworks - have been following Neal Ford for years... now it looks like they are coming up with something that has some direct impact on my recent research.

https://static.javadoc.io/com.thoughtworks.dsl/dsl_2.12/1.0.0-RC10/com/thoughtworks/dsl/index.html

As per the docs:

We also provide some built-in DSLs for asynchronous programming, collection manipulation, and adapters to scalaz.Monad or cats.Monad. Those built-in DSLs can be used as a replacement of for comprehension, scala-continuations, scala-async, Monadless, effectful and ThoughtWorks Each.


I have just completed writing a few Actors to solve the issue i had discussed in a previous post:

https://jmenke.blogspot.com/2018/04/backpressure-and-wasted-compute-cycles.html


I used become and Akka's FSM classes to provide a simple version and a version that used Master / Workers as I had talked about in the last post.

Now i see this:

For example, the akka provides a DSL to create finite-state machines, which consists of some domain-specific keywords like whengoto and stay. Unfortunately, you cannot embedded those keywords into your ordinary if / while / try control flows, because Akka's DSL is required to be split into small closures, preventing ordinary control flows from crossing the boundary of those closures.

and then 

For example, stateless-future-akka, based on stateless-future, provides a special final result type for akka actors. Unlike akka.actor.AbstractFSM's inconsistent control flows, users can create complex finite-state machines from simple ordinary control flows along with stateless-future-akka's domain-specific keyword nextMessage.

Maybe this DSL can overcome some of the limitations of using the FSM syntax?  I think I have to try it out to see.


No comments: