Hacker News new | ask | show | jobs
by banashark 700 days ago
F# has an interesting way to achieve a similar function in Statically Resolved Type Parameters (SRTP)

Palatable blog post: https://www.compositional-it.com/news-blog/static-duck-typin...

Official docs: https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

2 comments

That's an interesting feature I didn't know F# had. It sounds similar to row polymorphism (which I found a good description of here: https://news.ycombinator.com/item?id=7829766 ).
I sort of wish the defaults were flipped in F# - everything is inline by default.
Could you clarify that? Are you saying you wish everything could be inline by default? (It's not true that things are currently inline by default.)
Yes I would prefer compile-time duck-typing everywhere by default.

Well, I think that I would! It probably has unintended consequences.