Mike, Correction: FAQ s/b CodeReviewComments
peter On Thursday, September 26, 2024 at 7:08:25 AM UTC-4 peterGo wrote: > Mike, > > The Go FAQ begins with "Go interfaces generally ...". > > Go documentation is written in American English. > > generally adverb > > : in a general manner: such as > a : in disregard of specific instances and with regard to an overall > picture generally speaking > b : as a rule : usually > > https://www.merriam-webster.com/dictionary/generally > > Where is the contradiction? > > peter > > On Wednesday, September 25, 2024 at 5:03:48 PM UTC-4 Mike Graf wrote: > >> Sorry to revive this, but I'd like to add to conversation (without >> weighing in on correctness of the nil check) that it appears the CodeReview >> comments on interfaces ( >> https://go.dev/wiki/CodeReviewComments#interfaces ) and the FAQ nil >> error https://go.dev/doc/faq#nil_error give mutually exclusive >> guidance. >> >> >> >> On Wednesday, September 2, 2020 at 6:09:51 PM UTC-6 Ian Lance Taylor >> wrote: >> >>> On Wed, Sep 2, 2020 at 3:45 AM targe...@gmail.com <targe...@gmail.com> >>> wrote: >>> > >>> > > Other people have said this too, but I want to emphasize that there >>> > are not 4 potential states of an interface value. There are 2 >>> > potential states: 1) interface does not hold any value, and is == nil; >>> > 2) interface holds a value, and is != nil. >>> > >>> > Indeed, there are 2 states of interface observable from outside. >>> Although one of these observable states gets expressed through 2 states >>> invisible to outer world. Which isn't a problem on its own. >>> > >>> > > When you start talking about an interface as a fat pointer you are >>> > talking about how those 2 states are implemented. There are other >>> > possible implementations >>> > >>> > Yes. And that's not an issue on its own. The issue is, such >>> implementation detail kind of "leaks" sometimes and bites you when you >>> don't expect. And it does so because the way it gets constructed omits one >>> specific detail of conversion from pointer to interface. >>> >>> I don't think that is correct. The implementation detail never leaks. >>> An interface always either holds a valid value (is != nil) or does not >>> hold a valid value (is == nil). >>> >>> I believe the confusion is due to the overloading of "nil". It means >>> both an invalid interface and an invalid pointer, but you are >>> permitted to store an invalid pointer in a valid 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/e0b9e4fa-3035-4ce5-9c64-d92a0c4a7270n%40googlegroups.com.