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
24
u/matthieum Apr 29 '26 edited Apr 29 '26
I'm lost.
Since we're talking about blessed syntax, I assume that this means string literals...
... but then the author mentions Rust putting strings on the heap by default, when Rust string literals are actually just of
&'static strtype, which are baked in the binary.Rust... sucks a bit there.
First of all, Rust doesn't have
[]=, like C++ it only allows writing to an existing place, there's no special syntax for inserting via array index notation.The real issue, however, is that Rust
IndexandIndexMutare both magical and old (comparatively) and somehow require the implementer to return a place (by returning a reference), which means they cannot be implemented to return a new object... such as a proxy. I wish I could implementIndexandIndexMutfor bit-arrays, for example, but... it's just not possible.On the other hand, the
IndexandIndexMuttraits do handle slicing; no problem. The trick there is that in[..]the..is NOT part of an array slicing syntax, instead..is its own syntax creating a range object, andIndexandIndexMutcan be implemented to take a range as an argument.Reifying ranges/slice descriptors is great for many reasons -- notably to be able to pass/store said ranges/descriptors -- AND cherry on top they allow better composition for indexing. Full of awesome.
Everytime I read about Odin, I'm reminded this is definitely not the set of trade-offs I wish for :)
1
u/teerre Apr 30 '26
This blog is full of "I"s and it reflects an extremely narrow perspective. Of course, may be only the author uses Odin or everyone who uses Odin only needs these particular abstractions, but I would bet that those who complain about "blessed syntax" want to do something that is not strings or arrays, which makes the whole argument a case of arguing something nobody is saying
2
u/vanderZwan Apr 30 '26
Ironically, the languages that I first think of when seeing the words "blessed types" are Rebol and Red and their list of datataypes. The irony being that Rebol and Red are "write your own DSL"-languages, even more so than Lisp, so arguably the most un-Odin-like languages out there (well, I suppose Racket also falls into that camp via a different mechanism).