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") Whatever we were to add would not save you that many characters, considering that you’d have to configure this name source anyway. Java users miss out on the map part, but in sum that does not change much: final Iterator<Integer> names = Iterator.from(1); // if this syntax is missing we should provide it ... context.actorOf(..., "foo-" + names.next()); Regards, Roland > > -Michael > > On 05/04/15 14:37, Konrad Malawski wrote: >> Hi Michael, >> We have discussed such proposal in the past and decided that it does not >> carry it’s own complexity weight. >> >> We would have to special case some letters as markers, or introduce >> something else to mark what the “placeholder part” is, >> we also really do want to encourage developers to think about actor names - >> they are one of the most important things one has >> when debugging when something goes wrong (‘which actor?’ to which actor?’ >> ‘from which actor’?). >> Scala already has very nice built in string interpolation, so such a thing >> is as easy as writing s”something-$genId” >> >> For a more in-depth discussion on this idea please read the old issue: >> https://github.com/akka/akka/issues/16613 >> <https://github.com/akka/akka/issues/16613> >> Hope this explains the reasoning behind not providing such facility. >> >> -- >> Cheers, >> Konrad 'ktoso’ Malawski >> Akka <http://akka.io/> @ Typesafe <http://typesafe.com/> >> On 4 May 2015 at 23:26:24, Michael Frank ([email protected] >> <mailto:[email protected]>) wrote: >> >>> >>> On 05/04/15 02:34, Akka Team wrote: >>>> -> What are the best practices for naming ? It would be ideal if I >>>> can give a name and Akka appends a $1, $2 to the name for every actor >>>> created. >>>> >>>> Akka does not provide such functionality, either you use temp names when >>>> it maintains a counter, or give an explicit name. Just use an AtomicLong >>>> if you want to add your own monotonic counter to names. >>>> >>> >>> i think it would be great to have the ability to supply a template to the >>> name parameter of actorOf(), such that it generates a unique name in a >>> particular format, similar to the mkstemp() libc function. for example: >>> >>> val fooActor = system.actorOf(props, name = "foo-XXXXXX") >>> >>> would create a toplevel user actor called "foo-$a" (if we assume current >>> auto-naming behavior). >>> >>> is this something the akka team would accept a PR for in 2.4? it seems >>> like a rather small, localized change, but i haven't looked into the actual >>> implementation complexity. >>> >>> -Michael >>> -- >>> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> >>> >>>>>>>>>> Check the FAQ: >>> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> >>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user >>> >>>>>>>>>> <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] >>> <mailto:[email protected]>. >>> To post to this group, send email to [email protected] >>> <mailto:[email protected]>. >>> Visit this group at http://groups.google.com/group/akka-user >>> <http://groups.google.com/group/akka-user>. >>> For more options, visit https://groups.google.com/d/optout >>> <https://groups.google.com/d/optout>. > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/akka-user > <http://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. Dr. Roland Kuhn Akka Tech Lead Typesafe <http://typesafe.com/> – Reactive apps on the JVM. twitter: @rolandkuhn <http://twitter.com/#!/rolandkuhn> -- >>>>>>>>>> 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.
