I really like the DSL member approach, +1!

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 20 October 2015 at 11:27:11, Viktor Klang ([email protected]) wrote:



On Mon, Oct 19, 2015 at 11:04 AM, Konrad Malawski 
<[email protected]> wrote:

My main beef with the scaladsl for FlowGraph.Builder is that it both requires 
the builder to be implicit (as in { implicit builder => }) but also requires 
import FlowGraph.Implicits._, both of which are hard to discover if all you do 
is to work with the code (and not reading docs).

The question is how this could be improved, one solution would be to make the 
implicits available from the builder itself, so when you write `builder.` you 
get `dsl`/`ops` and the scaladoc thereof explains that you import it and need 
to make the builder reference an implicit and then you can use this awesome DSL 
to wire your graph.
Yes, I'd want to remove that implicits import a lot.

We show the ~> syntax in most places, so it's basically "the" DSL and really 
"oh and by the way there's another one".

I'd definitely lobby for and merge such change as part of the cleanups if you 
had a bit of time to try doing it.


If one puts `dsl` or `api` or whatnot as a member of Builder, then it get 
dot-completion, if then also we annotate Builder with @ImplicitNotFound, then 
we can guide the user to using `implicit builder =>` iso `builder =>`.

So:

val s = Sink.fromGraph( FlowGraph.create() { implicit b =>
  import b.api._
  … ~> …
  } )

Another option would be to move the arrow-dsl into the scaladsl package object 
to get it by default, then you'd only have to make the builder implicit (which 
we can assist with the @ImplicitNotFound). That would hamper discoverability of 
the api though, as there'd no longer be a dsl/api member of Builder.


 


-- 

Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe




--
Cheers,
√

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to