r/ProgrammingLanguages • u/ExplodingStrawHat • Apr 29 '26
Blessed Syntax and Ergonomics
https://www.gingerbill.org/article/2026/04/29/blessed-syntax-and-ergonomics/(not my article, but thought y'all might find it interesting)
33
Upvotes
View all comments
Show parent comment
4
u/lookmeat Apr 30 '26
I still think that Rust did a mistake in keeping C++'s naming mistakes.
&strshould have been&stringandStringshould have beenStringArrayorStringBufferor evenDynamicString.Would make a lot of these discussion more straightforward and clearer why the decisions are done for each type.
I'm gonna go and say that isn't a bad thing. I think that in a systems programming language there should be "dumb" operators that can't be overloaded, because what they do is done at a fundamental level. And I think that memory access (such as array) should be there.
I'll even go with a radical idea: I think it's fine to have custom members added to types (so I can create a
member (&mut self: Foo).bar -> &mut Baz { ... }as long as we use the[]operator to access thestruct's sub-elements directly without any magic.Custom operations should be done through member/method access instead. The problem is how to expose a "location" because it gets messy. In Rust you can kind of wing it with
MaybeUninitbut it has some limitations but it generally can be made good enough to describe a location.The result is that operators are for low-level things, which have very limited and specific things, and should normally not be used directly. Instead you want to enforce people to use common conventions and limited but good enough ways to extend the language. But to further promote this you try to make the language features themselves strain themselves to this limitation, otherwise programmers will build horrible contraptions around the issue. The Curse of LISP is that it allows you to modify the language, which lets you get 80% of the way very quickly (but the remaining 20% is just as hard in LISP as in any other language, but is comparably much harder now, it's easy to take on a project that is beyond your resources). But you want a language that can build an effective Domain-Extension-Language, that is that you can define and write in terms of the domain within the language in a way that it's clear how things map. The risk of Odin's choice is that one day someone is trying to do geographic coordinates, storing them as floats, and dealing with all kinds of issues because people keep forgetting how tricky the math is, that they aren't coordinates on a Cartesian plane. But again it depends on the space the language wants to explore and its powers and limits.