News for hackers. Stuff that matters.
Re:5 Weeks of Go by kibwen on Wednesday May 23, 2012 @01:20PM (#4014101)
"Names imported from a package are accessed by using the last component of the package name as a prefix (rather than the horrendous full package prefix that you often see in Java and similar languages)"

  import "image/color"
  x := color.RGBA{255, 255, 255, 0}
Perhaps I'm naive, but I thought you could do this in basically any language, including Java (it's been a while).

EDIT: Not sure why this was downvoted, but it's a trivial Google search[1] to show that this is indeed something that you can do in Java:

  import javax.swing.JOptionPane;
  
  class ImportTest {
      public static void main(String[] args) {
          JOptionPane.showMessageDialog(null, "Hi");
          System.exit(0);
      }
  }
Which, without the import, would force you to use the full name as the author alludes:

  class ImportTest {
      public static void main(String[] args) {
          javax.swing.JOptionPane.showMessageDialog(null, "Hi");
          System.exit(0);
      }
  }
I'm not intending to bash Go (it has the largest quantity of awesome features of any language I've seen in a long time), nor necessarily to defend Java. It just seems a bit disingenuous to claim that this is exceptional behavior.

[1] http://www.leepoint.net/notes-java/language/10basics/import....

Re:5 Weeks of Go by iand on Wednesday May 23, 2012 @01:36PM (#4014216)
The difference is that javax.swing.JOptionPane is a class whereas image/color is a package containing functions and types.

x := color.RGBA{255, 255, 255, 0} is instantiating an RGBA type from the image/color package

Re:5 Weeks of Go by yummyfajitas on Wednesday May 23, 2012 @05:22PM (#4015373)
In Java:

    import org.somelib.colors.*

    x = new RGBA(255, 255, 255, 0);
where RGBA is some class defined in the org.somelib.colors package.
Re:5 Weeks of Go by ssmoot on Wednesday May 23, 2012 @06:08PM (#4015576)
I think they're looking for:

  import org.somelib.*

  x = new colors.RGBA(255, 255, 255, 0);
So you don't have to bring all the classes into scope, but you don't have to write out the full path to use them either. Just the last bit of the package-name as a qualifier.
Re:5 Weeks of Go by plorkyeran on Wednesday May 23, 2012 @06:34PM (#4015675)
In C# that'd be:

  using colors = org.somelib.colors;
I don't know if Java has something similar.
Re:5 Weeks of Go by wolverian on Thursday May 24, 2012 @07:45AM (#4017881)
It doesn't.