On Mon, May 4, 2015 at 11:04 PM, Roland Kuhn <[email protected]> wrote:
> Hi Michael, > > 5 maj 2015 kl. 00:24 skrev Michael Frank <[email protected]>: > > thank you konrad for the detailed explanation! i have implemented this > in various ways in the past, and thought it would be nice to have a > unified, 'blessed' mechanism. however, i understand how the cost-benefit > tradeoff might weigh against it. > > > Saying “implemented” might be an overstatement given that it is not even > quite a full line: > > val names = Iterator.from(1).map(i => s"foo-$i") > I'll overlook the snark because that really is a nice one-liner :) But boilerplate is boilerplate, yes? My use case often involves child actors which have a well-known identity, but need to have a unique name for lifecycle purposes. so i might extract the above into a trait: trait UniqueNames { private val nameSource = Iterator.from(1) def uniqueName(prefix: String): String = prefix + "-" + nameSource.next.toString } Thank you Roland for your code example! -Michael -- >>>>>>>>>> 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.
