r/ProgrammingLanguages • • 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

22 comments sorted by

View all comments

Show parent comment

2

u/matthieum Apr 30 '26

I still think that Rust did a mistake in keeping C++'s naming mistakes.

I am not certain that bit came from C++, specifically.

Early Rust is very ML oriented, its compiler was not written in OCaml by coincidence, and all the keywords and built-in types were short lower-case -- for example ret for return.

str just fits that pattern as a built-in, and was not renamed afterwards.

3

u/ExplodingStrawHat Apr 30 '26 edited Apr 30 '26

I think str is ok as a name, String being the actual offending type. I do wish they would've called it StrBuf or something (like the Path types).

1

u/lookmeat May 01 '26

I am not certain that bit came from C++, specifically.

In this case I was talking about String which itself tries to be like C++ string, including the heap storage by default. If we wanted to keep str as the string type, we could have had StrBuf for the heap-allocated dynamic string. And maybe we could have a stack allocated string, it's just hard to predict the size.

This isn't the only type that had bad naming conventions from C++ inherited to try to make it more appeasing, Vec is probably the worst one, mixing elements of the short-hand notation that was used more at the start, with the naming convention of C++ that is acknowledged by everyone involved to be a mistake. I mean semantic is critical, but also completely arbitrary, so it doesn't matter much now. It's just always a problem in that it inspires people to misunderstand what the type is supposed to be by implying it's something else.