Re:Is Go Duck-Typed?
by _old_dude_ on Wednesday March 04, 2020 @05:00PM
(#22488626)
Java type system is not fully nominal anymore,
the operator :: does structural typing.
[ Parent
| on HN ]
Isn't this just the stuff making all lambdas implicitly implement a single-method interface and such?
On JVM level, yes. But on Java level, the type of the method is structurally matched to the type of the interface.
The name of the function is typically the same though, even with structural typing. This doesn’t seem quite like that.
If you mean the name of the function in the interface, it's basically ignored in this pattern, similar to how argument names are ignored. The entire interface definition should be treated as a function type with some redundant metadata.
Re:Is Go Duck-Typed?
by _old_dude_ on Thursday March 05, 2020 @02:27AM
(#22491624)
yes,
a lambda is (mostly) desugared as a static method and then the operator :: is applied.