Brian Candler schrieb am Sonntag, 19. September 2021 um 20:46:45 UTC+2:
>
> I'm not sure how useful that is though, especially because "return" inside
> that anonymous function will return from that anonymous function, not the
> outer function.
> https://go2goplay.golang.org/p/h6ZRnqM5cRx
>
https://go2goplay.golang.org/p/S_RDDxhTI1a
In fact, it can infer the type parameter:
https://go2goplay.golang.org/p/rk7jyt3ob0v
I'm not sure how useful that is though, especially because "return" inside
that anonymous function will return from that anonymous function, not the
outer function.
Brian Candler schrieb am Sonntag, 19. September 2021 um 13:38:49 UTC+2:
> Also, I may be missing the point, but does the following do what you want?
> https://play.golang.org/p/86DQD5QMbJ3
>
> _, err := os.Open("non-existing")
> if pe := ({}); errors.As(err, ) {
> fmt.Println("Failed at path:",
Also, I may be missing the point, but does the following do what you want?
https://play.golang.org/p/86DQD5QMbJ3
_, err := os.Open("non-existing")
if pe := ({}); errors.As(err, ) {
fmt.Println("Failed at path:", pe.Path)
}
On Sunday, 19 September 2021 at 12:24:13 UTC+1 Brian Candler wrote:
> I
I notice at least three things from your proposed syntax:
1. Passing a *type* as an argument ("os.PathError"), rather than a *value
of a type*
2. A control structure. This might involve passing a block of code as a
hidden argument (like blocks in Ruby), or some sort of macro expansion.
3. The