2 ms·
Logical, but assuming Int is reserved, I can't see why type-first would give the parser or developer any problems: var i = 1 //Type inference var Int
by hyperpallium 11y ago
Logical, but assuming Int is reserved, I can't see why type-first would give the parser or developer any problems:
var i = 1 //Type inference
var Int i = 1 //Explicit type
But it seems a common convention for optional typing. Maybe it suits dynamic developers?
- PeCaN 11y agoPersonally I just consider that uglier. Also you can parse var i: Int = 1 unambiguously without backtracking, while you have to backtrack on var Int i = 1 (unless you enforce some constraint like type names must start with capitals, in which case you may as well just do Int i = 1).