[go-nuts] Re: Generic Wrappers that do reflection on Initialization

2023-04-12 Thread Peter Müller
Update: I've found something similar in pkgsite https://github.com/golang/pkgsite/blob/beceacdece62d95d6dc41a9b5f09da7b2a021020/internal/database/reflect.go so I now assume it's not as far fetched as I thought until now. Peter Müller schrieb am Freitag, 3. März 2023 um 16:53:07 UTC+1

[go-nuts] Generic Wrappers that do reflection on Initialization

2023-03-03 Thread Peter Müller
Hello, would you assess the following usage of `Var[T any]`, `v = new(Var[T])` and `var person = rel.NewVar[Person]("person")` as valid pattern, that also enables it to be used in further generic methods, or would you rather prefer a codegen approach? ```go type Var[T any] struct { nam

[go-nuts] Proposal: Implicit Method Signatures

2018-09-28 Thread 'Peter Müller' via golang-nuts
The other day I had an interesting idea: What if all exported fields have an implicit getter. Like e.g. type Human struct { Age uint Name string } would implicitly get the methods: func (h Human) Name() string { return h.Name } func (h Human) Age() uint { return h.Age } *When defining an int