If I can, I want to make another comment about Go FAQ.

In section "Why can't the compiler infer the type argument in my program?" 
we read
"There are many cases where a programmer can easily see what the type 
argument for a generic type or function must be, but the language does not 
permit the compiler to infer it. Type inference is intentionally limited to 
ensure that there is never any confusion as to which type is inferred. 
Experience with other languages suggests that unexpected type inference can 
lead to considerable confusion when reading and debugging a program."
>From what I understand this if comment on the situation when we have 
function `f[T constraint](x, y T)` and we call it like `f(int(1), int(2))` 
can't infere that T should be a int (maybe it is stupid example, but I only 
use generics in such obvious cases). If I didn't know generics more I would 
understand text belowe as saying that code `f(int(1), int(2))` is always 
invalid and must be replaced by `f[int](1, 2)`. I would suggest to tweek it 
a bit, to make clear that Go has type inference, only more limited that in 
other languages.

Of course it is only my opinion.

Best regards,
Kamil

piątek, 29 września 2023 o 23:31:59 UTC+2 Kamil Ziemian napisał(a):

> Ok, there is one thing connected to Go FAQ that I don't like. 
>
> In section "When did Go get generic types?" we read "See the language spec 
> <https://go.dev/ref/spec> and the proposal 
> <https://go.dev/design/43651-type-parameters> for details.", where 
> proposal in question is "Type Parameters Proposal" (
> https://go.googlesource.com/proposal/+/master/design/43651-type-parameters.md).
>  
> "Type Parameters Proposal" is very good written document, I read it even 
> before Go 1.18 came out, but as Ian Lance Taylor said here when Go 1.18 was 
> released, this proposal is not 100% copatible with Go today. Few changes 
> was done when implementing generics and Taylor said that Go Spec is the 
> document that state how generics must work in Go. I find example of code 
> that is valid in the light of the proposal, but not in the light of Go 
> Spec, but I don't remember it. I propose that disclaimer should be added, 
> for example at the top o the proposal saying something like "This proposal 
> is not 100% compatibile with what was finally accepted in Go. Look to Go 
> Spec for acctual information.".
>
> As a side note, I like Go Spec, but it is not good document if you just 
> want to learn generics. Since they influance dozens of things (functions, 
> methods, iterfaces, you name it), description of them is scattered through 
> all document and I hear from true Go programmers, not hobbist like me, that 
> they have doubts if they understand generics description in Go Spec. I 
> would propose to add some quationary note about that to Go FAQ, but this is 
> only my humble opinion.
>
> Best regards
> Kamil
>
> piątek, 29 września 2023 o 22:21:35 UTC+2 Kamil Ziemian napisał(a):
>
>> Hello,
>>
>> I read Go FAQ again and I'm start to think that few minor things may 
>> needs some update. It is only my humble opinion and I'm not even true 
>> programmer, only hobbist, so if you disagree, you are probably right.
>>
>> "What is the purpose of the project?"
>> This section starts "At the time of Go's inception, only a decade ago, 
>> the programming world was different from today." Since first idea of Go is 
>> 2007 I guess that was written in 2017. If so it was six years ago and 
>> things change during that time, so maybe someone with more knowledge can 
>> review this part and say if is "up to date".
>>
>> "Is Google using Go internally?"
>> We read here "One easy example is the server behind golang.org.". From 
>> what I understand this should be updated to "server behind go.dev".
>>
>> Best regards,
>> Kamil
>>
>

-- 
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/7c120d98-6767-4598-953f-e49c3986f584n%40googlegroups.com.

Reply via email to