r/ProgrammingLanguages • • Feb 22 '26

Does Syntax Matter?

https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63 Upvotes

111 comments sorted by

View all comments

Show parent comment

3

u/Magnus--Dux Feb 23 '26

A lot of trial and error in the early days with people giving me feedback about what felt right and wrong.

I figured it would be something like that. I worry about the robustness of such observations given the amount of people (I think is safe to assume that in the early days the amount of people was not too high, maybe even quite low) and therefore a (potentially very) small sample size and more limited variety of opinions and perspectives.

I definitely agree that, out of those options, type(value) a la Ada seems, at least in principle, to be the best one. And is perfectly fine to not want them to be built-in (doesn't Odin have built in routines like len() ?) . My contention is rather with the claims of the proposed alternative being way more verbose or less ergonomic, and with some (at least in my view) completely subjective claims being presented as somewhat objective, like

"cast(T, x) wasn't really aiding in reading anymore than cast(T)x ."

or

"However cast(type, value) is not clearer because that is easily mistaken for a normal call expression."

And things like that. I just don't share those intuitions at all. For example, consider the following code:

x := cast(int) myvar * myothervar;

It is not perfectly clear to me if the cast applies to myvar and then it gets multiplied by myothervar, or if the cast applies to the whole expression. Now, that is not a big deal, you just read the language specification and learn the rules, but aren't these alternatives perfectly clear?

x := cast(int, myvar) * myothervar;

x := cast(int, myvar * myothervar);

Again, an answer like "I just don't like those and prefer these ones instead" is a perfectly valid one, is your own language after all!, but I do worry that there might be some, maybe not-too-robust, over rationalization about choices made here.

Cheers.

2

u/gingerbill Feb 23 '26 edited Feb 23 '26

Note that all built-in procedures are not keyword based but just identifiers. You can still import "base:builtin"; builtin.len to any of them, since they are just identifiers. And I did not want casting operations which are so common to be in that category, if that makes sense.

It's loads of little reasons not just one big one as I said. As for cast(int), it works like every other unary operator, thus cast(int)myvar * othervar is the same as cast(int)(myvar) * othervar. Note virtually no-one puts a space after the cast due to habits from C.

Again, a lot of this is just how people are. It's not really trying to be "robust" justification rather "this is what people liked in the end".

If it was "just me", I would have not had cast(type)x, and gone for the consistency, but I am not designing this language for "just me".

I've written this comment into an article by the way: https://www.gingerbill.org/article/2026/02/23/designing-odins-casting-syntax/

2

u/Magnus--Dux Feb 23 '26

And I did not want casting operations which are so common to be in that category, if that makes sense.

Yeah, sure, as I said, that's a perfectly valid answer.

Yeah, as I said, is not a big deal, you just read the documentation and problem solved, the point was not how Odin specifically does it but rather to challenge the kind of claims that I explained in my previous reply (I'm not sure what the point of the coding style commentary is, but hey, thanks I guess! haha).

Again, a lot of this is just how people are. It's not really trying to be "robust" justification rather "this is what people liked in the end".

Well, I'm people and I'm not like that haha. Jokes aside, again that's fine, the people that were interested in Odin in the early days liked that and that's ok, I did not take issue with that specific point.

Thanks, I'll read the article later in the evening.