Re: [go-nuts] Generics: after type lists

2020-09-06 Thread targe...@gmail.com
Sorry for interfering. I've gathered statements and expressions which look like candidates for interface-based generalization. Interface and method names are just placeholders. Generic interfaces for collections like slice or map are different beasts. Will post thoughts on them later. I person

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-09-02 Thread targe...@gmail.com
email.com wrote: > On Thu, Aug 27, 2020 at 12:53 PM targe...@gmail.com > wrote: > >> Because you then must remember about this specific case *every time *you >> cast potentially nil pointer variable to interface. Every time you must >> write `if x != nil { return x; }

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-09-02 Thread targe...@gmail.com
nter to interface. On Thursday, August 27, 2020 at 9:58:21 PM UTC+3 Ian Lance Taylor wrote: > On Thu, Aug 27, 2020 at 3:53 AM targe...@gmail.com > wrote: > > > > Please don't forget that interface pointer isn't simple. It's a > so-called "fat pointer"

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
wrote: > On Thursday, 27 August 2020 11:39:11 UTC+2, targe...@gmail.com wrote: >> >> To me, if `x == nil` and then `y != nil` after `y = x` is much more >> confusing. >> > > This can happen only if x and y have different types. > And for different types

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
> I'm mostly form C++ land from of course :) On Thursday, August 27, 2020 at 2:01:33 PM UTC+3 targe...@gmail.com wrote: > I know this. I'm mostly form C++ land, so you may imagine how many warts > are there "on the top of the index finger" :) > I'm

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
ang-nuts < > golan...@googlegroups.com> wrote: > >  > > > On Thu, Aug 27, 2020 at 11:39 AM targe...@gmail.com > wrote: > >> > I'm saying the current situation is less confusing than what you >> describe, yes. >> > AIUI, with what you describe, if I

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
nger's state. If we wanna static implementation, we just create static variable which is `struct{}` and return pointer to it. Alas, this approach is no-go because it involves breakage too deep. On Thursday, August 27, 2020 at 1:14:17 PM UTC+3 axel.wa...@googlemail.com wrote: > On Thu, Aug

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
> On Thu, Aug 27, 2020 at 11:10 AM targe...@gmail.com > wrote: > >> it would definitely. Though price for consistency looks very much >> acceptable. > > > I don't think "consistency" is at all the right word here. If anything, > things would get *le

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
converting a T to a T changed program behavior Sorry, didn't get it. Are you saying that nil pointer -> nil interface is more confusing? On Thursday, August 27, 2020 at 11:49:16 AM UTC+3 axel.wa...@googlemail.com wrote: > On Thu, Aug 27, 2020 at 10:06 AM targe...@gmail.com > w

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread targe...@gmail.com
Not sure if it was mentioned here, but IMO the main issues isn't nil data itself, but how easy it's created. It'd be much less of a surprise if creating nil-data required explicit cast from nil struct pointer to interface pointer and resulted in just nil interface pointer in case of implicit ca