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.
@trochee @xgranade may as well call a highly specialized type or behavior thing in the language/compiler a "feature" at this fucking rate

Or, hell, why not just keep overloading object?
object Object<object: Object>(object: Object) {}

bastards
@trochee @xgranade write a programming language that dares to refer to brackets as "objects"

or even just uses
object object, which represents the classic { } in other languages...
@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.

@cthos @aud @trochee A possibly unfortunate example, but I'm reminded of the judge in E. Jean Carroll's defamation case against Trump clarifying that Trump did not rape her in the New York legal system's definition of the word, but *did* do so following the common English sense of the word, such that it was not inaccurate nor defamatory to say that he did so.

@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 @aud @trochee Yeah, I almost made that point with the original post in my thread, where you have two very different ways of doing the same nominal thing, "define a function that acts on a Bar-like value."

Which one *should* an AI code generator do? Which one will an LLM trained on O(GitHub) do when it rolls the 1dOOP dice? Who knows!

@xgranade @aud @trochee

“Don’t worry about that! The vibes will sort it out! Live a little. What’s the worst that could happen” - Some guy I made up.

@cthos @aud @trochee Like, the whole act of programming is to take some poorly defined goal, make that goal precise, come up with a design that would accomplish that goal, and then implementing that design.

You can't just YOLO your way through taking an imprecise goal to a precise and actionable goal!

@cthos "AI, sort this list for me." Motherfucker, *how*? Merge sort? Introspection sort? Bubble sort?

We even have a way of making that precise, and the AI bros just... don't do that! One of the few things I actually like about C++ is that the STL specifies things like sort in terms of guaranteed algorithmic complexity, rather than a specific algorithm, so you have a precise definition of what properties you're guaranteed when you call the STL's sort function.

@xgranade “I have sorted the list! It also now includes extra items. You’re welcome!”

@cthos @xgranade

You must have prompted it wrong

@cthos But with AI? Who knows! Is your list nearly sorted? Do you need to sort it in-place? Do you need your sort to be stable under equivalence of the sorting key? Do you care more about worst-case or average-case performance?

Aaaaaaaaaaaaaaaa

@xgranade Listen, I just need it to do JortSort on everything.

https://jortsort.glitch.me/

jortSort • a solution to sorting

@cthos Reminds me of anthropic sort: check if the list is sorted, and if not, kill yourself. In any universe that you are alive to observe, the list is sorted.

@xgranade And via collapsing the superposition, I am both immortal and the list is already sorted, right?

Right?

> You can't just YOLO your way through taking an imprecise goal to a precise and actionable goal!

There's a whole fleet of management consultants and DOGE interns and J6 insurrectionists who would argue this point

@xgranade @cthos @aud

@trochee @xgranade @aud I _almost_ made this point but my “oh shit everything is on fire” account is over on bsky <3

@cthos @trochee @xgranade

You can't just YOLO your way through taking an imprecise goal to a precise and actionable goal!There is 1000% a joke to be made involving that being literally just LinkedIn.

@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"
@cthos @xgranade @trochee "halp why is my mouse moving itself"
@cthos @xgranade @trochee "Remember Jia Tan and the XZ backdoor? Anyway we trained this language model on code written by who knows how many Jia Tans and gave it root."
@cthos @xgranade @trochee gonna pollute the "corpus" with a bunch of shell commands that rename user 1000 to "youareanasshole" and see how long it takes for someone to write an issue report somewhere complaining about it

@aud @trochee @xgranade

Aww look at how precocious it is!

@aud @trochee You couldn't call it a "kind," either, since the functional folks have taken the word to refer to the order of a given type or type constructor. E.g.: concrete types have kind `*`, type constructors like `list` have kind `* -> *`, and so forth.

The mathematicians took "set," "group," and so forth.

So we're stuck with "typeclass" partially conflicting with both "type" and "class," such that people feel compelled to endlessly reinvent synonyms.