News for hackers. Stuff that matters.
Re:C# almost has implicit interfaces by banashark on Thursday July 25, 2024 @11:47PM (#41075624)
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...

Re:C# almost has implicit interfaces by fire_lake on Friday July 26, 2024 @02:12AM (#41076182)
I sort of wish the defaults were flipped in F# - everything is inline by default.
Re:C# almost has implicit interfaces by Smaug123 on Friday July 26, 2024 @02:54AM (#41076382)
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.)
Re:C# almost has implicit interfaces by fire_lake on Friday July 26, 2024 @06:00AM (#41077316)
Yes I would prefer compile-time duck-typing everywhere by default.

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

Re:C# almost has implicit interfaces by zogrodea on Friday July 26, 2024 @04:35AM (#41076880)
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 ).