And when reading through code no Java developer goes, hmmm I wonder what a List is - since List in idiomatic use is the List interface from java.util.List. Could it be another List type, possibly the java.awt.List, but that’s only used in awt related code, and if it’s truly a different List type, they’ve probably decided to use it throughout the application - at least I would.
Say the coders decide to use the Guava libraries - even then, their interfaces almost always extend the standard ones, so an ImmutableList interface is still a List, and so any of the Guava list implementations could be assigned to it. I’m not a big fan of DI, but that’s the essence - everything thing on the left is an interface, and usually a well known one, unless the List needs additional semantics, like ImmutableList - you might change it to give the code reader more information - but still you wouldn’t refer to it at com.google.common.collect.ImmutableList, you would import it, and use ImmutableList. Which brings me back to why the ‘stutter’ is useful - it allows dot imports to work, without it they cannot. > On Dec 2, 2018, at 12:04 AM, robert engels <reng...@ix.netcom.com> wrote: > > The .* doesn’t mean what you think it does - that just means all of the > classes in the package. It is no different than listing them each. > > When you use > > import java.util.Collections; > import java.util.List; > > You are actually doing a dot import, so you can in the code just refer to it > as so > > List list = Collections.singletonList(someobject) > > otherwise you need to write the code as: > > java.util.List list = java.util.Collections.singletonList(someobject); > > > > >> On Dec 1, 2018, at 11:51 PM, Ian Denhardt <i...@zenhack.net> wrote: >> >> Quoting Robert Engels (2018-12-02 00:19:40) >>> I know everyone hates it when I reference java but it has had dot >>> importsat the package level since day one. I won’t repeat why that >>> matters. It’s never been a problem. >>> >>> I don’t think I ever heard someone complain it was a problem in >>> working in Java, why is it such a problem in Go? >> >> I'll admit to not having much experience with large Java projects, so >> hard for me to say why this would be in Java. But from browsing through >> the source of a handful of open source Java projects, my first guess is: >> nobody uses them. It seems the norm is to just import each class you >> want to use individually; I don't see much .* >> >> This is why it works out in Elm -- because people don't use it much. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.