On Sun, Mar 11, 2012 at 11:57 AM, Roland Tepp <[email protected]> wrote:

> Well... I would say actually, that this is one of these cases where the
> Language has it wrong ...
> ... and now every developer dow that road has to pay the tax of knowing
> that "thee shall never use == for comparing objects for equality. And oh,
> by the way, Integer is an object too..."
>


I'm not sure how it's difficult to remember how objects work, or to
remember that you used a wrapper class precisely because you needed some
object-like behavior in your integers. I agree that the language has  got
it wrong, but I'd say the problem is more that the minor convenience of
autoboxing has apparently got people confused about what Integers are.
Another case of syntactic sugar gone wrong.




> laupäev, 10. märts 2012 23:23.28 UTC+2 kirjutas Ricky Clarkson:
>>
>> That's lovely, but doesn't help at all when you inherit code that does it
>> wrong. :)
>>
>> On Sat, Mar 10, 2012 at 6:20 PM, Jon Kiparsky <[email protected]>wrote:
>>
>>> "Also, knowing that Integers are objects isn't the problem, it's that ==
>>> succeeds sometimes."
>>>
>>> That's for sure. I don't remember who said it, but this is a case of
>>> "syntactic sugar leads to cancer of the semicolon". I still say it's the
>>> programmers job to know the language, and part of that is knowing that
>>> object comparison with == is always wrong, even if the implementers have
>>> made a stupid decision to make it work for some arbitrary values. Really,
>>> it's not a particularly obscure or subtle fact about the language.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "The Java Posse" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to javaposse+unsubscribe@**
>>> googlegroups.com <javaposse%[email protected]>.
>>> For more options, visit this group at http://groups.google.com/**
>>> group/javaposse?hl=en <http://groups.google.com/group/javaposse?hl=en>.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/javaposse/-/tKKTvZCNqToJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to