On Tuesday, 16 August 2022 at 21:15:03 UTC+1 axel.wa...@googlemail.com 
wrote:

> You are looking for "Featherweight Go", I believe.
> https://arxiv.org/abs/2005.11710
>

That's an interesting paper - at least the early parts that I could 
understand!

I tried converting <https://go.dev/play/p/yJvOncevnoP> their main 
motivating example from fig 8, but got stuck by not being able to put a 
method on a parameterised type:

func (e Plus[a Evaler]) Eval() int {
    return e.left.Eval() + e.right.Eval()
}
// ./prog.go:21:16: syntax error: unexpected Evaler, expecting ]

func (e Plus[Evaler]) Eval() int {
    return e.left.Eval() + e.right.Eval()
}
// ./prog.go:24:16: e.left.Eval undefined (type Evaler has no field or 
method Eval)
// ./prog.go:24:33: e.right.Eval undefined (type Evaler has no field or 
method Eval)

func (e Plus[a]) Eval() int {
    return e.left.Eval() + e.right.Eval()
}
// ./prog.go:24:16: e.left.Eval undefined (type a has no field or method 
Eval)
// ./prog.go:24:33: e.right.Eval undefined (type Evaler has no field or 
method Eval)

Is this what is meant by:


*Another result is the proposal for covariant receiver typing, a feature 
required by The Expression Problem. It is not part of the Go team’s current 
design, but they have noted it is backward compatible and are considering 
adding it in the future.*

?

-- 
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/528c0c73-e2db-4153-a505-6003deb886f2n%40googlegroups.com.

Reply via email to