re: What ever happened to putting the object type on the left? VIEW POST


I think it has more sense like "here is X, a type Y variable" but anywayI think it all started with Fortran (type on the left) but there were exceptions like Basic

ASTRING$ = "Hello World"

There are also "neutral" ones, in which you do not have to specify the type (including Go), Lips or everything is a word (BCPL).

To answer your question I think this stackoverflow answer got it right

All of the languages you mentioned support type inference, which means the type is an optional part of the declaration in those languages because they're smart enough to fill it in themselves when you provide an initialization expression that has an easily-determined type.

That matters because putting the optional parts of an expression farther to the right reduces parsing ambiguity, and increases consistency between the expressions that do use that part and the ones that don't.

And New vs Old is relative to our age :))

Having the type after the identifier is not a new phenomenon, it goes back to at least Pascal (designed 1968–1969, released in 1970), but actually was used in mathematical type theory, which starts ~1902. It was also used in ML (1973), CLU (1974), Hope (1970s), Modula-2 (1977–1985), Ada (1980), Miranda (1985), Caml (1985), Eiffel (1985), Oberon (1986), Modula-3 (1986–1988), and Haskell (1989).


Very good. Just as a side note, the type in UML goes to the right as well, I guess for similar reasons.

Code of Conduct Report abuse