December 20, 2025
Classless code, classy chaos
Extending ts-Wolfram: dropping OOP, kernel/userspace interop, better printing
Bye-bye classes, hello clean code: ts‑Wolfram sparks cheers, jeers, and parentheses wars
TLDR: ts‑Wolfram dropped classes for a simpler model and now lets built‑in and user rules mix, fixing awkward math like -a(-b). The community is split: functional fans cheer the cleaner approach, while skeptics worry about “footguns,” and everyone’s memeing about the printer’s stubborn parentheses
The ts‑Wolfram project just ditched "classes" (aka OOP—object‑oriented programming) for a cleaner, pipeline-style approach, and the comments went full reality show. Functional fans are celebrating, calling it a glow‑up for code you can reason about. Meanwhile, OOP loyalists are clutching their pearls, warning this is how you end up with spaghetti in a lab coat. The big headline: you can now mix built‑in engine rules with user‑written ones, so typing something like “-a(-b)” smartly becomes “a*b.” Half the thread cheered “finally,” the other half screamed “footgun!” and posted exploding tool gifs. Printing got a facelift too—no more wall-of-text math when you just want shorthand—after the dev realized adding formatting rules to the "ToString" feature caused chaos. So, pretty printing moved into TypeScript, and the crowd yelled “ship it!”…until they hit ParenthesesGate: products like Sin(Cos(x)) Sin(x) still show extra parentheses. One side insists it’s a minor cosmetic pothole, the other swears a printer is the hardest boss in programming. Commenters dropped memes (“Hold my beer,” except they literally typed Hold[]), hot takes, and even a few “just use Mathematica” drive‑bys. It’s nerd theater, and yes, we’d watch this write‑up again
Key Points
- •The interpreter transitioned from OOP-based AST classes to an algebraic data type for expressions, simplifying code and removing instanceof checks.
- •Mixed kernel (TypeScript) and userspace (Mathematica) definitions are now supported for the same function.
- •A prelude rule Times[Minus[x_], Minus[y_]] := Times[x, y] enables -a (-b) to evaluate to Times[a, b] without modifying TypeScript logic.
- •Pretty printing is implemented in TypeScript after attempts to use userspace ToString and StringJoin caused unintended evaluation.
- •A FullForm command was added for debugging; printer still mishandles some precedence/parentheses cases (e.g., Sin[Cos[x]] Sin[x]).