News for hackers. Stuff that matters.
Re:Can you use a class in C? by cryptonector on Sunday August 13, 2023 @01:34PM (#37112099)
Nowadays OO is seen as a mistake.

Interfaces are much better. What's the difference? It's this: no inheritance.

Still, with interfaces your complaints remain unsatisfied. But add generic functions and then you can have the mix of OO-like and not-OO-like APIs you have in mind.

Re:Can you use a class in C? by iraqmtpizza on Sunday August 13, 2023 @07:49PM (#37115810)
I don't want to imagine something like gson or sun.tools.tree without inheritance. That would be a disaster.

Composition? AssignShiftLeftExpression has-a AssignOpExpression which has-a BinaryAssignExpression which has-a BinaryExpression which has-a UnaryExpression which has-a Expression which has-a Node?

    return this.assignOpExpression.binaryAssignExpression.binaryExpression.unaryExpression.expression.node.op;
or

    return this.op
Re:Can you use a class in C? by cryptonector on Monday August 14, 2023 @12:35AM (#37117495)
You want "sum types", aka "algebraic types".
Re:Can you use a class in C? by iraqmtpizza on Monday August 14, 2023 @01:01AM (#37117631)
I don't want them; you want them.
Re:Can you use a class in C? by cryptonector on Monday August 14, 2023 @05:19PM (#37126943)
Heh, it's a manner of speaking. As in "the solution is to use sum types". Obviously i can't make you want that.