PROPOSAL: 'final' without explicit type (update)

Marek Kozieł develop4lasu at
Mon Mar 30 16:09:21 PDT 2009

W dniu 31 marca 2009 00:45 użytkownik Gabriel Belingueres
<belingueres at> napisał:
> Hi Marek:
> - VariableInitializer type is neither primitive nor Object.
>  --> primitive : they should not be mixed with Object-s to easy.
>  --> Object : when object type is Object, we mostly deal with
> situation 'Unknown type', so this should not be hidden.
> I still don't get why it is so bad to do something like this:
> final a = 1; // static type is int
> or
> final o = new Object(); // static type is Object, no doubt
> I still don't see the point on not making this feature more orthogonal
> (unless some convincing argument is presented against it.)

For primitives I would prefer:
primitive a = 1; // a is int / short / byte
rather than:
final a = 1; // static type is int

Primitives represent other level of abstraction and mixing them will
make people to be confused (more or less).

final o = new Object(); // in this form it's ok

here I see problem:
final o = some.getBoo().getLocalization(); // o is Object

For some reason we did not ensured valid type to be returned, so we
should care about it while declaring 'o', or say that we do not care:
final o = (Localization) some.getBoo().getLocalization();
final Object o = some.getBoo().getLocalization();

If we allow final to be ANY type, then backing to declaration will be
required just to make correction, this will piss off programmers.

So primitives and Object-s are special types and should be handled in this way.

Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

More information about the coin-dev mailing list