Thanks, does the go standard library have a use case where a private() function in a interface is needed? Looking for more examples to understand the benefit to do so.
On Friday, June 21, 2019 at 2:36:01 AM UTC+2, Ian Lance Taylor wrote: > > On Thu, Jun 20, 2019 at 5:25 PM Gert <gert....@gmail.com <javascript:>> > wrote: > > > > Trying to get my mind around why the private() function is necessary > here. I fail to understand the comment provided > > > > type Geometry interface { > > GeoJSONType() string > > Dimensions() int // e.g. 0d, 1d, 2d > > Bound() Bound > > > > // requiring because sub package type switch over all possible types. > > private() > > } > > > > https://github.com/paulmach/orb/blob/master/geometry.go#L10 > > Some packages use an unexported method like this to ensure that no > type defined outside of the package can implement the interface. > > Ian > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d5e8602c-7fdc-477e-806e-7e675bd5a2d3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.