The compiler should be able to work it out from the grammer.
Yes, initialising is key, this is how F#, Go and other lang's with type inference do it.
Here's a sample of Go code, it adds the type after the variable name as in the size.Event type below:
import (
"fmt"
"image"
"image/color"
"log"
"time"
"golang.org/x/mobile/event/lifecycle"
"golang.org/x/mobile/event/mouse"
"golang.org/x/mobile/event/key"
"golang.org/x/mobile/event/size"
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
)
var (
// set up some global helper var's
winWidth, winHeight = 800, 650
// We can get info from the event.Size() function along with other
// helpful functions and data.
sizeEvent size.Event
)
Note that by convention in Go, these variables (or functions) are only global in the scope of the module (this file), variables and functions starting with capital letters are public to everywhere.
'By Convention' sounds a bit strict but the convention is sound and all code looks the same as most editors use the gofmt and go import tools on save which automatically formats your code and brings in or deletes unused imports, very handy.
VS is getting better at this though and format on save would be nice....maybe it can be setup with an editor event??
EDIT (John): Getting forum errors from GiShi so I disabled the GisHi "go" code tag.