Yeah ducks are the worst
# announcements
s
Yeah ducks are the worst
👍 2
v
duck lovers use JS 🙂 they just type stuff and hope that the duck knows how to kwack 😄
m
I have a feeling you are mixing ducktyping with either dynamic typing or weak typing.
Go is strongly, statically typed and has ducks.
v
Oh i didn't know that go does that, nice
m
I think Haskell too, but I might be wrong here. I never really used it.
d
Scala does
I like it
also TypeScript
m
Scala has ducktyping? Wow, didn't expect a language on JVM to have this.
d
Structural typing
m
Yeah, reading about it now.
d
is heavy at runtime cost
m
Looks like anonymous interface.
d
and produce a lot of bytecode
m
Yes, I would expect that on JVM to be of some cost.
d
most scala styles discourage it
but is useful for cheap and dirty (at code level) reflection tricks
for example calling a method that you know is there but you have a higher type like
Any
you could cast it to an structural type
and call the method
t
I was just wishing the other day you could do a type alias of composite types. something similar to what you can do with generics.
typealias AB = A & B
Figured it implies the underlying system supports duck typing