Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-04-28 Thread Bruno Bieth
Well, I've suggested it: https://github.com/scala/scala/pull/5137 On Wednesday, April 27, 2016 at 4:41:07 PM UTC+2, Bruno Bieth wrote: > > I agree with Roland that having a Future[Unit] may lead to subtle bugs due > to the value discarding mechanism. My favorite is mixing map and flatMap by > mi

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-04-27 Thread Bruno Bieth
I agree with Roland that having a Future[Unit] may lead to subtle bugs due to the value discarding mechanism. My favorite is mixing map and flatMap by mistake: // this compiles just fine: map[T] is infered to be map[Unit], then Future { println("two"); Done } which is of type Future[Done] is di

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread Roland Kuhn
There is one other use that these types can be put to: Scala’s habit of conjuring a Unit out of thin air where needed can make it non-obvious where all the exit points of a method are. Declaring a different return type means that all such points need to be marked out explicitly. But outside the

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread Konrad Malawski
Yeah, agree with Patrik here. It's mostly for `Future[Done]` and situations like that, void/Unit is still fine in normal return values. --  Cheers, Konrad 'ktoso’ Malawski Akka @ Lightbend On 24 February 2016 at 13:35:02, Patrik Nordwall (patrik.nordw...@gmail.com) wrote: On Wed, Feb 24, 201

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread Patrik Nordwall
On Wed, Feb 24, 2016 at 1:23 PM, rklaehn wrote: > Hi Konrad, > > So, if it wasn't for backward compatibility, the return type of tell would > be akka.NotUsed, to signal that successful return does not tell you > anything about successful processing of the message (akka.Done would > certainly be w

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread rklaehn
Hi Konrad, So, if it wasn't for backward compatibility, the return type of tell would be akka.NotUsed, to signal that successful return does not tell you anything about successful processing of the message (akka.Done would certainly be wrong)? Cheers, Rüdiger On Wednesday, February 24, 2016

Re: [akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread Konrad Malawski
Hey Rüdiger, yeah those can definitely be used in all kinds of APIs. The reason we have them mostly in Streams for now is because we could not break compatibility in akka-actor for example. The types are intended to be simply more informative than plain `Unit`, so wherever that's needed feel fre

[akka-user] Intended use for akka.Done and akka.NotUsed

2016-02-24 Thread rklaehn
Hi all, given the prominent position of akka.Done and akka.NotUsed: are these only meant to be used within akka streams, or also elsewhere? I am currently trying to introduce futures into a codebase with a lot of blocking, and it sure would be helpful to distinguish between methods returning U