Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It sounds like a great use of interfaces, but what is Go-specific about it? Couldn't the same thing be done in Java? (And I imagine it probably already has.)


The specific thing, IMO, is the fact that the interface itself is specified in the Go standard library along with plenty of utilities for working with it.

Java does have similar things, but, as far as I know, they're limited to the UI libraries and far more complicated (e.g. https://docs.oracle.com/javase/7/docs/api/java/awt/Image.htm...). Imagine if everyone who read or wrote image files in Java were guaranteed to conform to a dirt-simple "Image" interface with only three methods--with optimizations available but strictly optional.

For someone who's just tinkering or just wants to dump some cool bitmaps, the ability to write an "At(...)" function in Go and be looking at a PNG within a few seconds is just great fun to have in the standard library.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: