https://kotlinlang.org logo
#announcements
Title
# announcements
s

sreich

03/28/2017, 10:00 AM
Yeah ducks are the worst
👍 2
v

vach

03/28/2017, 10:05 AM
duck lovers use JS 🙂 they just type stuff and hope that the duck knows how to kwack 😄
m

mg6maciej

03/28/2017, 10:07 AM
I have a feeling you are mixing ducktyping with either dynamic typing or weak typing.
Go is strongly, statically typed and has ducks.
v

vach

03/28/2017, 10:10 AM
Oh i didn't know that go does that, nice
m

mg6maciej

03/28/2017, 10:11 AM
I think Haskell too, but I might be wrong here. I never really used it.
d

dh44t

03/28/2017, 10:30 AM
Scala does
I like it
also TypeScript
m

mg6maciej

03/28/2017, 10:33 AM
Scala has ducktyping? Wow, didn't expect a language on JVM to have this.
d

dh44t

03/28/2017, 10:33 AM
Structural typing
m

mg6maciej

03/28/2017, 10:34 AM
Yeah, reading about it now.
d

dh44t

03/28/2017, 10:34 AM
is heavy at runtime cost
m

mg6maciej

03/28/2017, 10:34 AM
Looks like anonymous interface.
d

dh44t

03/28/2017, 10:34 AM
and produce a lot of bytecode
m

mg6maciej

03/28/2017, 10:35 AM
Yes, I would expect that on JVM to be of some cost.
d

dh44t

03/28/2017, 10:37 AM
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

trevjones

03/28/2017, 3:30 PM
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
3 Views