On Tue, Aug 9, 2016 at 9:48 AM, Sam Salisbury <samsalisb...@gmail.com> wrote:
>
> The update I suggest is to add the following sentence to the end of the
> reflect.Value.IsNil documentation:
>
>> Likewise, if v was created by calling ValueOf on an initialised
>> interface{} value with a nil value pointer j, v.IsNil will return true,
>> whereas j == nil will return false.

Thanks for the suggestion.  That wording seems a little complex, in
that reflect.ValueOf is always passed an interface value by
definition.  That is, if you call reflect.ValueOf with a value V of
interface type, that is exactly equivalent to calling reflect.ValueOf
with the non-interface value that was stored in V.  If we eliminate
that part of your suggestion, it seems to reduce to "If v was created
by calling ValueOf on a nil pointer j, v.IsNil will return true" which
doesn't seem helpful.

To put it another way, I think you are identifying a deeper issue,
that doesn't really have anything to do with IsNil, and perhaps could
be better documented somewhere in the reflect package.  Although
ValueOf does already say "ValueOf returns a new Value initialized to
the concrete value stored in the interface i."

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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to