"This is why I said that this seems like a regression and suggested that 
you file an issue. We have an error message for this particular mistake. We 
have tests to see that the right error message is printed when it happens. 
We clearly care about providing helpful errors. The error message doesn't 
appear in a case where it seems that it should."

"This is purely about changing the error message from the compiler, not 
changing whether or not code is being accepted. There is absolutely no 
question that `type A[3] int` should continue to compile fine. There is no 
question that `type A[float64] int` shouldn't. It's just that the error for 
the latter case should include the "invalid array bounds" message."

Thank you for that Axel. You are very kind with explaining this to me in 
such details. I still have little understanding what is "regression in Go".

I file two issues yesterday. They are probably stupid, but after your 
explanation, I was thinking that if there are stupid, I would learn what to 
not post.

"Also note that `gofmt` will automatically reformat this code to be clear 
about the intention. So, I wouldn't worry about it being unreadable if 
people do."

Ooo, yes `gofmt`. Thank you for bringing it back to me, I constantly forgot 
about it. This is a quirk of mine, that I when I try to learn `gofmt` I 
constantly go back to my problems with understanding Unicode and UTF-8.

You should laugh at me, I deserve it. I also try to laugh at myself. :)

I have a lot to do in this week, so I maybe silent for few days.

Best,
Kamil
poniedziałek, 14 lutego 2022 o 00:05:04 UTC+1 axel.wa...@googlemail.com 
napisał(a):

> On Sun, Feb 13, 2022 at 11:23 PM Kamil Ziemian <kziem...@gmail.com> wrote:
>
>> "So, no, this is not something that I made up to have an example or 
>> anything like that. I thought about a couple alternative ways to do it and 
>> they all don't work for one reason or another."
>>
>> Thank you for the information. Do you check if performance of generic 
>> code is good? I always want to know if there is regression in performance.
>>
>
> Performance does not matter in ~all cases I'm concerned with so far.
>
> I see no reason why performance would suffer for my case, though, as it 
> currently uses interfaces and reflect. If anything, performance should 
> improve (even if calls are still indirect) as I can completely remove 
> reflect and remove some of the type assertions.
>
> There are certainly cases where performance will suffer, when compared to 
> generated code for a specific types, FWIW. It's just that they are not what 
> I'm talking about here.
>
> "FWIW, here is code that assigns to varSI in two ways:  
>> https://go.dev/play/p/ypj6rQbpBBl";
>>
>> From what I understand "type someInterface [3]interface{ SomeMethod() }" 
>> define interface array of three elements of "interface{ SomeMethod() }" and 
>> as such it should rather be name "someArrayOfInterfaces". Am I right?
>>
>> Also, can someone give me an example, where it is desired to use such 
>> type?
>>
>> Best,
>> Kamil
>> niedziela, 13 lutego 2022 o 17:44:30 UTC+1 jake...@gmail.com napisał(a):
>>
>>> On Friday, February 11, 2022 at 10:02:42 AM UTC-5 kziem...@gmail.com 
>>> wrote:
>>>
>>>> I'm seriously lost here. Code below works in both Go 1.17 and Go 
>>>> 1.18beta2
>>>>
>>>> > package main
>>>> >
>>>> > import "fmt"
>>>> >
>>>> > type someInterface[3] interface {
>>>> >         SomeMethod()
>>>> > }
>>>> >
>>>> > func main() {
>>>> >         var varSI someInterface
>>>> >
>>>> >         fmt.Printf("varSI value: %v\n", varSI)
>>>> >         fmt.Printf("varSI type:  %T\n", varSI)
>>>> > }
>>>>
>>>> and give in both cases result
>>>> > varSI value: [<nil> <nil> <nil>]
>>>> > varSI type:  main.someInterface
>>>>
>>>> I didn't find any way to assign some new value to "varSI", but this is 
>>>> already disturbing to me.
>>>>
>>>
>>> FWIW, here is code that assigns to varSI in two ways:  
>>> https://go.dev/play/p/ypj6rQbpBBl
>>> Note that running this code in the playground will reformat ' type 
>>> someInterface[3] interface' to the proper ' type someInterface 
>>> [3]interface'. This is not a change in meaning, just a clarifying white 
>>> space change made by `go fmt`. 
>>>
>> -- 
>>
> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/0966efb7-7b73-4001-87f6-71a6362fe350n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/0966efb7-7b73-4001-87f6-71a6362fe350n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/2eb3c55e-9e46-49fc-b681-39c3752e318bn%40googlegroups.com.

Reply via email to