3 ms·
The proposed syntax feels like a caricature to me. That something like this could be easily possible: func (c Connection) Read(type T Writeable)(into *T) (
by 013a 7y ago
The proposed syntax feels like a caricature to me. That something like this could be easily possible:
func (c Connection) Read(type T Writeable)(into *T) (int, error) {
This is quite securely inside shark-jumping territory.
Also; I haven't seen Rob Pike's name really anywhere in these blog posts or discussions, or on any recent Go blog entry. Is he still involved with the Go project day-to-day? I always got the impression that he was one of the bigger anti-generics voices on the team internally.
- monkeyfacebag 7y agoAs far as I can tell, the latest proposal draft forbids type parameterized methods. One must admit the type parameter to the receiver or define a type parameterized function. I am making no claims about your broader point, only clarifying that your example is not permitted by the proposal draft. See https://go.googlesource.com/proposal/+/4a54a00950b56dd0096482d0edae46969d7432a6/design/go2draft-contracts.md#methods-may-not-take-additional-type-arguments https://go.googlesource.com/proposal/+/4a54a00950b56dd009648...