2

In languages like TypeScript, Scala, F#, etc. the type of the variables are on their right side, i.e.

variableName: DataType

However in C# or Java I usually start typing the Type first, the intellisense brings up the required type, then as soon as I start typing the name of the variable, the intellisense suggests me the variable name based on the type, I think this makes the type to be best placed on the left side.

This makes me wonder what are the benefits of such a design in languages that have the types on the right side. Obviously, there should be many and I also sense the reasons are to do with functional programming constructs. Can't those constructs be done if the type was on the left?

Ghost4Man
  • 1,040
  • 1
  • 12
  • 19
  • With functions/operators the fixity is important, because it determines how you can compose them. Functions are prefix and hence must be nested, ops are infix and have a flat composition syntax. But this doesn't apply to types, because you don't compose them. Maybe someone can prove me wrong on this. What you have on the type level are higher-order type constructors that need a first-order type constructor and a proper type to create a new type. They are kind of like higher order functions on the term level. It still doesn't matter on which site you annotate them. –  Apr 30 '20 at 07:43

0 Answers0