Oh, I almost forgot, it also clearly does not "have minimal impact on everybody else", which is another proposal selection criteria. Go code becomes much more complex to read and understand from all the examples I have seen.
You can even find several YouTube videos with people trying to analyze and understand the Go generics code in the examples, and they are all struggling.
--
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/910771608795256%40sas8-ed615920eca2.qloud-c.yandex.net.
I'm sorry, but this is not real life problems. This is exactly the problem with this proposal. It's based on nothing but small theoretical examples.
--
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/16410701608794283%40vla5-c5051da8689e.qloud-c.yandex.net.
I'm sorry, but this is not real life problems. This is exactly the problem with this proposal. It's based on nothing but small theoretical examples.
--
I write this from my understanding of the "Proposal selection criteria", which clearly states, that in order for a proposal to be accepted, it has to "address an important issue for many people".
This is why I'm asking for real life problem examples, not theoretical ones.
I do not believe that adding generics solves any real life issues that is important for many people. These small examples with sorting lists etc. clearly do not present an important issue (real life problem) for many people.
--
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/813181608794977%40iva3-77ae5995f07f.qloud-c.yandex.net.
--
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/rs1rb2%246mc%241%40ciao.gmane.io.
I'm sorry, but this is not real life problems. This is exactly the problem with this proposal. It's based on nothing but small theoretical examples.
--
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/CAOyqgcXSTfERSeNPiBpSJAw28%3DqygeC5dHQrK_sz9ONOTWf-EA%40mail.gmail.com.
I therefore propose that the pro-generics camp provide real examples of
problems they have faced that was such a big issue that it justifies
adding generics to Go.
I have been arguing passionately against adding generics to Go because
I truly believe that it is going against the simplicity of Go and the
philosophy behind the design of Go.
I believe that the resilience of Go against unnecessary change is of
vital importance. The experience provided by Ken Thompson, Rob Pike and
Robert Griesemer in designing Go the way they did speaks for itself.
I feel and believe it is of imperative importance to avoid adding things
to Go that doesn't present a true and real life day-to-day problem
and so far none of the examples the pro-generics camp has provided has
been more than minor theoretical examples that do not present any real
life problems.
I therefore propose that the pro-generics camp provide real examples of
problems they have faced that was such a big issue that it justifies
adding generics to Go.
If all we're presented are these small theoretical examples of sorting
lists, etc., then clearly this is nothing but hype that needs to go
away.
--
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/19560461608790506%40sas1-75175cadc2b3.qloud-c.yandex.net.
Don't get me wrong. No doubt there are use cases which cannot be
solved reasonably without generics. No doubt there are many other
cases where generics will be an elegant and still readable solution
either.
--
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/CAGrdgiX6CdGPx76z-QZ3jz-Rr8E-LX36%2B%2BD8p_fh5HF1CnUh%2Bg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/483c3f92-097e-4954-b4df-135b6ab561e4n%40googlegroups.com.
I believe that the resilience of Go against unnecessary change is of
vital importance. The experience provided by Ken Thompson, Rob Pike and
Robert Griesemer in designing Go the way they did speaks for itself.
I have been arguing passionately against adding generics to Go because
I truly believe that it is going against the simplicity of Go and the
philosophy behind the design of Go.
I believe that the resilience of Go against unnecessary change is of
vital importance. The experience provided by Ken Thompson, Rob Pike and
Robert Griesemer in designing Go the way they did speaks for itself.
I feel and believe it is of imperative importance to avoid adding things
to Go that doesn't present a true and real life day-to-day problem
and so far none of the examples the pro-generics camp has provided has
been more than minor theoretical examples that do not present any real
life problems.
I therefore propose that the pro-generics camp provide real examples of
problems they have faced that was such a big issue that it justifies
adding generics to Go.
If all we're presented are these small theoretical examples of sorting
lists, etc., then clearly this is nothing but hype that needs to go
away.
--
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/19560461608790506%40sas1-75175cadc2b3.qloud-c.yandex.net.
So switching from subject to my personality and telling me what I should and what shouldn't, to whom to listen, and what to read is something in line with "code of conduct" which you appeal as the argument of last resort?
--
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/CADKwOTek6rrfmMziuj5poy4hAZJ%3DHXsyp-FB96RdUvZ%2BncoJYA%40mail.gmail.com.
If 95% of generics are collections the current draft is overkill.
What about a simplified version with only one generic type (like we do
with interface{}), without constraint as long as it can compile ?
func add(x, y GenericType) GenericType {
return x + y
}
add(1,2) // add can compile : func add(x, y int) is generated
add("abc", "def") // can compile : func add(x, y string) is generated
add(1, "abc") // two differents type : error
GenericType will be like interface{} but instead of casting it'll
generate on the fly, at compile time the function with the type of each
functions call.
I believe it's too easy and i miss something already discussed...
--
wilk
--
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/rsk0bb%24tg6%241%40ciao.gmane.io.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGDOqWgEE2a_B9%2BqXftPc6ebBPcs_DcpsrqOvR%2BpCZ9SQ%40mail.gmail.com.
I’ll state for the record again, I was originally very dismayed that Go did not offer generics - after developing with it for a while that is far less of an issue to me than the error handling.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfFp0ozY5BAUudH-upa7neRjdtUQ%2Bk-o-%2BGox0q0%2BhJwEQ%40mail.gmail.com.
I have been arguing passionately against adding generics to Go because
I truly believe that it is going against the simplicity of Go and the
philosophy behind the design of Go.
I believe that the resilience of Go against unnecessary change is of
vital importance. The experience provided by Ken Thompson, Rob Pike and
Robert Griesemer in designing Go the way they did speaks for itself.
I feel and believe it is of imperative importance to avoid adding things
to Go that doesn't present a true and real life day-to-day problem
and so far none of the examples the pro-generics camp has provided has
been more than minor theoretical examples that do not present any real
life problems.
I therefore propose that the pro-generics camp provide real examples of
problems they have faced that was such a big issue that it justifies
adding generics to Go.
If all we're presented are these small theoretical examples of sorting
lists, etc., then clearly this is nothing but hype that needs to go
away.
--
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/19560461608790506%40sas1-75175cadc2b3.qloud-c.yandex.net.
If all we're presented are these small theoretical examples of sorting
lists, etc., then clearly this is nothing but hype that needs to go
away.
Go has been in existence for 10+ years and has fairly wide adoption in some areas - so it is not hard to make the case that generics are “not an important thing”
- depends on what you are trying to do with it and what your perspective on “the right way” is.
On Dec 31, 2020, at 8:39 PM, 'Axel Wagner' via golang-nuts <golan...@googlegroups.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfF1g1J9gD%2Bz3A%2Bsw-Qf5gkT81uK%2BMiXiAvGZyo_zhLjYA%40mail.gmail.com.
Of course. But you don’t design a language (or any other product) for the 5% - you design it for the 95 (80?} percent - if you want you have customers/users and stay relevant (in business).
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/bj6kMQBTqUY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGgD6C5T5qh747pEwzy1mjmGToYZj2jEE8koMckPk0vNA%40mail.gmail.com.
One thing that comes to mind that is not supported by the current proposal is the ability to express that T must be (any) struct.
[…]
Another example is where you write a library that creates an RPC service from any function that you provide:
On the other hand, I don't see a lot of cases myself where I would want to call some method on T in a generic function, mainly because there's already interfaces and helper function for this in Go if you need it. For example, you could say that a generic priority queue must call a method Priority() on T, but that could be done in an equally type-safe way by asking for a helper function to be provided with T (ie. func (T) int) with the container. There's the graph example in the generics proposal but I think that that can have a likewise type-safe solution that doesn't need the ability to call a method on T.
On the other hand I agree that an "interface" in its meaning of a "declaration of a method set" applies equally well to compile time and runtime. So the current argument is (I think) that generics is just the application of interfaces at compile time instead of runtime.
The issue I have with this is that it complicates (at least) the language around the concept of "interface" at lot (just think about all the documentation around interface that needs to be rewritten, and if someone asks a question on a interface you first need to address if it's used runtime or compile time, etc).
A second issue is that, in my opinion, it does not agree very well with the idea of "one way of doing things" / orthogonality in Go (as explained above).>> The third use-case I see for generics is to catch bugs by being able to express more complicated type-invariants in code. An example of that would be type-safety for context.Value (or, similarly but subtly different, optional iThe context.Value example is maybe an example of something that to me feels (at least initially) as a suspicious application of generics. If context.Context is made generic (if this is what is meant) then all functions that use it, such as in the sql package, are forced to be generic too:Before you know it everything is generic.... On the other hand, maybe this is something that you just need to get used to and be very happy with after. My initial reaction would be that the right choice here would be to make context not generic as Value is only a "extra" customer user value that is not part of its main functionality/purpose. However, it would possibly be tempting to factor interface{} into a T if you don't think too much about it.
-Markus
--
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/28dfab48-9413-4658-9272-bcc79f73153fn%40googlegroups.com.
So magic here is being able to say "stop".
Hi,On Fri, Jan 1, 2021 at 1:41 PM Markus Heukelom <markus....@gain.pro> wrote:One thing that comes to mind that is not supported by the current proposal is the ability to express that T must be (any) struct.[…]Another example is where you write a library that creates an RPC service from any function that you provide:Personally, given that in both of these cases you still need to use `reflect` and there's still a lot of type-errors that can happen, I feel the wins here are relatively minor. There definitely are some and if they could be added more or less "for free", I'd definitely support that. But I don't see, personally, how that could be done.
As an example, a similar case is expressing that an argument must be a pointer - for example, for json.Unmarshal. It has a similar level of benefit (json.Unmarshal also still needs to use reflect to actually set fields or values) - but in that case, there is already a "free" way to achieve it with the design (that is, use `func Unmarshal[type T any](b []byte, p *T) error`).On the other hand, I don't see a lot of cases myself where I would want to call some method on T in a generic function, mainly because there's already interfaces and helper function for this in Go if you need it. For example, you could say that a generic priority queue must call a method Priority() on T, but that could be done in an equally type-safe way by asking for a helper function to be provided with T (ie. func (T) int) with the container. There's the graph example in the generics proposal but I think that that can have a likewise type-safe solution that doesn't need the ability to call a method on T.You could argue, that you don't actually *need* methods or interfaces at all. Instead of passing an `io.Reader`, you could pass a `func(p []byte) (int, error)`. And instead of passing an `io.ReadCloser` you could pass that func and a `func() error`. At the end of the day, an interface is just a table of functions.
On the other hand I agree that an "interface" in its meaning of a "declaration of a method set" applies equally well to compile time and runtime. So the current argument is (I think) that generics is just the application of interfaces at compile time instead of runtime.I think the argument is rather "we want a way to constrain types and interfaces already provide a familiar way to express such constraints".It's just about re-using a familiar mechanic, instead of introducing a new one (in fact, the previous incarnation of contracts *would* have introduced a new mechanic and that was one of the main criticisms of it).
The issue I have with this is that it complicates (at least) the language around the concept of "interface" at lot (just think about all the documentation around interface that needs to be rewritten, and if someone asks a question on a interface you first need to address if it's used runtime or compile time, etc).I do think interfaces change, but only to accommodate type-lists. I'm not a huge fan of that aspect of the design myself.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGgD6C5T5qh747pEwzy1mjmGToYZj2jEE8koMckPk0vNA%40mail.gmail.com.
Real use cases have been provided it appears for both why generics can be good and how they can be used negligently (love the sextuple example BTW).
--
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/CAGrdgiVJe_2L5QZ13v-SBZq2C7_e6nX8JDCAE23BcpWqGyH99Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAJhgaci-M2iL%3DjPL2KB3BbhzRahBz4pjDUPjkiTAF_jjza6FAw%40mail.gmail.com.
I do believe (hope) David was kidding. Anonymous product types (and similar constructs) are the root of all evil.
FWIW I'm certain that the lack of tuples in Go was a very deliberate decision - one of Go's more significant ancestors, Limbo, had tuples.Anonymous product types have their disadvantages too (you don't get to name the members, so code can end up significantly harder to understand), which I suspect is why Go didn't get them.
> People will even realize that when you compile this, you don't have to pass a pointer to said tuple but can make a choice on calling convention which passes such tuples in registers to speed up the system and be as fast as any other language.I believe that the new register calling convention will do this for structs FWIW.
On Sunday, 3 January 2021 at 18:43:22 UTC+1 ren...@ix.netcom.com wrote:I do believe (hope) David was kidding. Anonymous product types (and similar constructs) are the root of all evil.Yes, you need dependent product types. Especially anonymous ones.