Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Go In Three Easy Pieces
Apr 13, 2012 at 1:53 AM@Zura:
But, ad-hoc interfaces mean that any interface can implemented by any type, there's no implements keyword. How can the compiler know what types the programmer intended to implement a given interface. The example I gave is a way for the programmer to be explicit about his intent if he wants to be.
Assignments are checked statically. For example, if you pass something as the first argument to http://golang.org/pkg/fmt/#Fprintf, the compiler will ensure that it has an Write method with the appropriate signature (http://golang.org/pkg/io/#Writer).
In fact, even the trick I linked to isn't used very much in the standard library. The standard library is extensively tested, and just the fact that the tests compile often verify a lot of such cases.
Lang.NEXT 2012 Expert Panel: Native Languages
Apr 13, 2012 at 1:42 AMTo be fair to C++, I believe the spec includes (large) sections on the standard library, not just the langage itself.
Also, for comparison, here is the Go spec: http://golang.org/ref/spec
Go In Three Easy Pieces
Apr 11, 2012 at 12:10 AM@Zura @Luna
You get integrity checking by assigning to a variable of interface type. If you don't need a variable, you can assign to '_' which acts as a sort of /dev/null. See http://golang.org/src/pkg/encoding/json/stream.go#L187 for an example, where lines 187 and 188 are verifying that *json.RawMessage conform to the json.Marshaler and json.Unmarshaler interfaces.