Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Boxed ints have identity, whereas primitives do not; boxing is not able to fully paper over this gap.

I don't know why the glossed over small values of Integer's sharing identity (effectively behaving like values) when discussing the complexity of these things.

From 5.1.7. Boxing Conversion[0]: "If the value p being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2."

[0] https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html...

I like this bit:

> These so-called primitive classes can combine the expressive power of classes with the runtime behavior of primitives. The slogan for Valhalla is:

    Codes like a class, works like an int.
I can immediately get a sense of what I'm getting--very much like Go using a non-pointer receiver for a function.


> I don't know why the glossed over small values of Integer's sharing identity

It is mentioned in the second part if I remember correctly regarding changes to identity-dependent operations (namely ==).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: