this post was submitted on 01 Sep 2023
3 points (80.0% liked)

Programming Languages

1167 readers
11 users here now

Hello!

This is the current Lemmy equivalent of https://www.reddit.com/r/ProgrammingLanguages/.

The content and rules are the same here as they are over there. Taken directly from the /r/ProgrammingLanguages overview:

This community is dedicated to the theory, design and implementation of programming languages.

Be nice to each other. Flame wars and rants are not welcomed. Please also put some effort into your post.

This isn't the right place to ask questions such as "What language should I use for X", "what language should I learn", and "what's your favorite language". Such questions should be posted in /c/learn_programming or /c/programming.

This is the right place for posts like the following:

See /r/ProgrammingLanguages for specific examples

Related online communities

founded 1 year ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old

If this is the worst you can come up with, 100% worth the price, would recommend ad-hoc polymorphism 10 times out of 10.

[–] davawen@programming.dev 2 points 1 year ago (1 children)

???
I fail to see the point of this blog post.
The example given makes no sense (maybe because it's very simplistic, and a more complicated one would show the point better?), you would NEVER use .iter().count() if you had direct access to the Vec. The iterator is more general in this sense.

You would use it if, say, your Settings struct was generic over an Iterator type, and in that case it's the whole point, isn't it?? Like what???

[–] armchair_progamer@programming.dev 1 points 1 year ago* (last edited 1 year ago)

Yeah this one's a miss on my end. I saw "ad-hoc polymorphism is UNSAFE?" and well, it does a better job reinforcing that ad-hoc polymorphism is not unsafe.

Author should have wrote a piece "how even type-safe programs can fail" and used his example to show that. Because what this really shows is that type-safety doesn't prevent programs with the correct types but bad semantics. But that's not ad-hoc polymorphism; it can happen anywhere (sans ultra-specific types) including even the author's workaround if he used Vec<Vec instead

[–] tram1@programming.dev 2 points 1 year ago

I think the author does not deserve Haskell