3 ms·
I prefer Pascal-style type declaration as well, but playing Devil's advocate for a moment: There's nothing that says you can't have a left-to-right type declara
by ANTSANTS 13y ago
I prefer Pascal-style type declaration as well, but playing Devil's advocate for a moment: There's nothing that says you can't have a left-to-right type declaration syntax and have the variable name appear on the right. So something like this:
var ptr_to_array_of_ptr_to_int : *[](*int)
would become something like this:
*[](*int) ptr_to_array_of_ptr_to_int
The former syntax is slightly easier for a program to parse, makes it easier to see variable names, and is more consistent with typical syntax for type inference during variable assignment:
var something := some_function(whatever)
auto something = some_function(whatever)
However, the latter does, as xaa said, eliminate some keystrokes. I also happen to find
byte foo = 10
to read more nicely than any of these:
var foo : byte = 10
var foo := (u8)10
var foo := 10'u8