Hello.
It seems to me that many new programming languages write type annotations in the reverse order (compared to the C order).
That is, some new languages, like Rust, write type annotations the following way:
number: i32
while it is in this order in C-like language:
int number
What is the advantage of the former vs the latter?
Is there any reason to use the reversed syntax?
I know this is a bit off-topic, but I have not found this on the Internet and did not know where to ask this question.
If this kind of question is not appropriate here, could you tell me where to ask this question?
Quickly, what is the identifier being declared? It's objectMetadataCallback, but that's nestled inside other syntax giving a return type and arguments. The Rust analog would be:
The type is actually its own phrase, not a context in which the variable being declared is nested. And note that if you take out the mut keywords, they're about the same length.
I think the C type syntax was motivated by the desire to use the same syntax for expressions as for types: If **x is an int, then clearly x must be a pointer to a pointer to an int. My opinion is that it was an interesting idea, but not a good one in the end.
I believe we used a keyword (let) because it is easier to parse when there is a pattern, right?
Otherwise, we could have used the Go way (identifier type).
Thanks to everybody else for their answer. They were very useful.