Switching on float/double/long
kevinb at google.com
Fri Dec 15 20:44:10 UTC 2017
On Fri, Dec 15, 2017 at 11:58 AM, Dan Smith <daniel.smith at oracle.com> wrote:
> > On Dec 13, 2017, at 5:51 PM, John Rose <john.r.rose at oracle.com> wrote:
> > But we only get to set the default once. So perhaps we should delay
> > supporting floats directly, until we can put all three or four float
> > matching predicates in front of us and decide which is the default.
> > On Dec 14, 2017, at 9:09 AM, Kevin Bourrillion <kevinb at google.com>
> > Switch on long: sure.
> > Switch on float/double: why?
> When you guys say you'd like to _not_ support floating-points, I'm not
> sure what you mean.
> The input to a switch can have any type, including Object.
If this much is given, then yes, of course we should allow `switch
(primitiveDouble)`. I was trying to connect the dots before and I think
I've got them now. My *current* limited understanding is that (a) it makes
a lot of sense for the pattern-matching feature to use the existing switch
construct, and (b) it follows inescapably from that that `switch
(somePrimitiveDouble)` will work no matter what (via boxing) so therefore,
right, we might as well just support it. Is that a reasonable way to put it?
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
More information about the amber-spec-observers