I'd say smalltalk (a 70's language) had it right, make *everything* an object.
But Java was desperate to attract the many developers already using C++ (an 80's language), and one of the tactics used was to make Java as similar to C++ as possible, including the handling of primitives. There's also an argument that primitives offer better performance, but there was nothing to stop the Java team using primitives on the JVM whilst still representing them as objects in the language. If everything is an object, then the solution is simple: make == always use .equals for object types and test directly for equality where primitives are used in the VM. Reference equality is generally a specialised sort of operation, and better exposed in a way that's far harder to perform accidentally. Problem solved! Of course... It would be terribly cynical of me to believe that this whole issue comes down to a marketing requirement, and that we already knew how to do the "right thing" for a good two decades before the language was devised :) 2012/3/11 Cédric Beust ♔ <[email protected]> > > On Sun, Mar 11, 2012 at 8: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 ... > > > I would say that this is an incorrect hindsight. I think that this kind of > little detail was very important in 1995 and probably contributed to make > Java the success it is today, even if it looks like an odd decision today. > > -- > Cédric > > -- > 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. > -- Kevin Wright mail: [email protected] gtalk / msn : [email protected] quora: http://www.quora.com/Kevin-Wright google+: http://gplus.to/thecoda <[email protected]> twitter: @thecoda vibe / skype: kev.lee.wright steam: kev_lee_wright "My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra -- 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.
