Submission: switch (...) instanceof feature

brucechapman at brucechapman at
Sun Mar 29 17:47:09 PDT 2009

Quoting Marek Kozieł <develop4lasu at>:

> This is death path.
> As I already said every month you will need switch to more complex
> operations and Java will be come Pyton.
> 1. String
> 2. instance of
> ...
> n. Unsigned String


> n+1. ...
> This syntax should support all those, and even more:

It doesn't support the instanceof form because one feature (the most important
feature IMHO) is the implicit downcast of the variable to the type specified by
the case. It is also different because it is switching on a variable or
identifier, not an expression.

Personally I think closures gives us a good enough (though by no means ideal)
solution to this problem. But there is a decision to make, - do we keep adding
special language syntax for all verbose idioms, or do we add a few language
features that mean we can solve these problems adequately with an API. The fact
that ARM has made the first cut suggests the former, so therefore, given this
(IMHO poor) choice, I'd at least like my pet issues to have an opportunity to be
dealt with in similar fashion.


> -- 
> Pozdrowionka. / Regards.
> Lasu aka Marek Kozieł

More information about the coin-dev mailing list