The keyword var
means mutable variable with explicit dynamic
type specifier.
The explicit type specifier means that this is not possible specify another type in declaration.
The keyword final
means val
or immutable variable with unspecified type, with implicit dynamic
type.
The implicit type specifier means that this is possible specify other type in declaration.
More precisely variable that declared as val
are the value
and variable
at once.
It are variable because has the runtime storage
.
But it are also immutable value
that can be retrieved from associated storage just once and can be used anywhere.
Now consider the following code:
final var foo;
This is the same as the following pseudo code:
immutable mutable dynamic foo;
Of course, this will not work.