object oriented programming: there are 50 classes. they all have some overlap in their venn diagram. some of the overlap is in a third or fourth dimension that cannot be graphed with human brains. your eyes register nothing but a hideous, writhing mass when you try.
@aud The problem with OOP in general, IMHO, is that it couples subtypes and typeclasses in a very confusing way.
@aud You can kind of deal with that by being very disciplined about keeping your inheritance tree to zero or one levels of depth, and using fully abstract classes (interfaces) to do the bit that looks more typeclass-y, but it's very hard to add new functionality to an existing design that way without breaking back compat... so folks tend to just poke holes in the design instead.

@aud To be a little more precise, a function like `void foo(Bar bar)` and one like `fn foo<T: Bar>(bar: T) -> ()` are morally quite similar, if extremely different in literal meaning. They're both ways of saying "this function takes a value of any type that's Bar-like," but the former *also* adds that any individual value of a Bar-like type can be referred to by a binding of type Bar.

That's a very heavy additional assumption, and places severe constraints on how you organize code.

@xgranade

this function takes a value of any type that's Bar-like,you know what's interesting, is I haven't really had to play too many object oriented struggle games in C/C++/C-style languages, thankfully, so I wasn't actually aware of this specific distinction. Usually I just watch the compilation fail, curse loudly, cast, and move on.

@aud Yeah, basically polymorphism says that there's no difference between a type T having U-like behavior, and T being a subtype of U. So then you get that in order to do U-like things with a value of type T, you need to be able to bind it to a variable or parameter of type U, which, fine... but that leads to a lot of nonlocal confusion down the road.
@aud Consider a function like `Addable add(Addable a, Addable b)`. The clear intent is that you can add two values together of the same type together, so long as that type is addition-y. But there's a missing constraint there, namely that the two parameters are the same subtype of T.

@aud So you can solve that with `T add<T>(T a, T b)`, but now you've lost the `Addable` constraint. The most common solution I've seen is to have `T add<T: Addable>(T a, T b)`.

But there's a word for "a collection of types that can be used to satisfy a constraint on valid type parameters." It's a typeclass, or in Rust terminology, a trait. Or in C++ terminology, a concept.

@xgranade @aud

> It's a typeclass, or in Rust terminology, a trait. Or in C++ terminology, a concept.

love to have three different names for a similar thing, all of which are overloaded in other English uses (except maybe `typeclass`)

@trochee @xgranade HAD THE EXACT SAME THOUGHT

like WHY did you pick "concept". I don't love the overloading of trait, but it's better than concept ffs.
@aud @trochee Oh, it gets even better. C# has a proposal for something that's a mix of protocols and typeclasses, called a "shape." (To be fair, since it's neither a protocol nor a typeclass exactly, they did need a new name of some kind.)
@xgranade @aud @trochee I’m pretty sure all OO languages confuse terms amongst each other.

@cthos @aud @trochee Yeah, it's really annoying. Then again, every eurogame, CCG, JRPG, TTRPG, and so forth reuses keywords (e.g.: what does "basic" mean), so it might just be a side effect of trying to lock down precise and formal rules for how to interpret common words.

See also: math and law.

@xgranade @aud @trochee Human language is ambiguous? Good thing we didn’t train an evil genie robot on it and shove it everywhere!

…wait.

@xgranade @aud @trochee It’s okay, at least we didn’t give it permission to run scripts on our computers or do stuff unsupervised.

…sorry, wait, I’m receiving reports…. oh gods.

@cthos @xgranade @trochee the thing that cracks me up about this is that like, all the people pushing "agentic AI" (IE, "we gave the malware generator root access") are like "you have to TRY it, just LEAVE it OPEN, START IT UP, LET IT GO UNSUPERVISED, WALK AWAY, BE SURE TO LEAVE YOUR BANK PIN SOMEWHERE WHERE THE COMPUTER CAN ACCESS IT" and it's like buddy I don't even fucking call /dev/urandom with sudo, ffs, I'm not gonna let some Sam Altman's propaganda machine have it.
@cthos @xgranade @trochee "wow, it wrote a SQL query for me, pushed it to production, deleted the log files, enabled root ssh login and wait"

@aud @trochee @xgranade

Aww look at how precocious it is!