Re: [go-nuts] Re: infinite recursion in method lookup due to recursive embedded interface value: any way to statically catch this?

2018-03-14 Thread Maverick Woo
Hi folks,

I think there may be two "bugs" in the discussion here.

The first one is definite and it is the "Bg" in the original playground 
example, which is intended to illustrate a bug made by the programmer: the 
intended "Bug" method is missing, either due to a typo in an attempt, or 
simply not attempted.

The second one is a maybe and it is whether the Go compiler + runtime 
toolchain is doing the right thing. As I have indicated in my initial post, 
I don't consider the present behavior unreasonable. Whether it is a bug or 
not depends on perspective and so I think both of you are correct.

Having said the above, please let me point out that method promotion is a 
language feature, and if one can write a program that compiles but 
ultimately causes a crash due to the method promotion feature, then I hope 
you would agree it may (but need not) be considered a toolchain bug. I did 
not look into the toolchain source code, but I can imagine the toolchain 
writer may be able to catch this using a progress check during method 
lookup. However, pragmatically speaking, let's just say a progress check 
can be and has been implemented and an infinite recursion has been detected 
at run time. What would we do? We would abort the program anyway and so the 
progress check is just wasted work. That was my reasoning on why I think 
the current behavior is reasonable.

I hope this is satisfactory.

Maverick

On Wednesday, March 14, 2018 at 3:16:15 AM UTC-4, M P r a d e s wrote:
>
> How is this a bug? I don't think Go compiler can guess the intent of the 
> developer at compile time.
>
> I don't think that qualifies as bug. 
>
>
> Le mardi 13 mars 2018 16:48:32 UTC-3:30, Christopher Sebastian a écrit :
>>
>> @prades.marq , The solution that you pointed out is already obvious to 
>> everyone.  Maverick was not asking "how" to solve the problem.  He is 
>> pointing out an interesting corner-case bug in the Go runtime. 
>>
>

-- 
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.


Re: [go-nuts] Re: infinite recursion in method lookup due to recursive embedded interface value: any way to statically catch this?

2018-03-14 Thread prades . marq
How is this a bug? I don't think Go compiler can guess the intent of the 
developer at compile time.

I don't think that qualifies as bug. 


Le mardi 13 mars 2018 16:48:32 UTC-3:30, Christopher Sebastian a écrit :
>
> @prades.marq , The solution that you pointed out is already obvious to 
> everyone.  Maverick was not asking "how" to solve the problem.  He is 
> pointing out an interesting corner-case bug in the Go runtime. 
>

-- 
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.


Re: [go-nuts] Re: infinite recursion in method lookup due to recursive embedded interface value: any way to statically catch this?

2018-03-13 Thread Christopher Sebastian
@prades.marq , The solution that you pointed out is already obvious to
everyone.  Maverick was not asking "how" to solve the problem.  He is
pointing out an interesting corner-case bug in the Go runtime.

-- 
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.