I was stumbling around the net and discovered that suggestions have been made for primitive types to be removed from future versions of the Java programming language.
This is insanity in the Java community.
.Net (C#) has a best-of-both-worlds solution called "boxing".
If they made a change to Java they should implement a similar feature.
Removing primatives would wreck performance. You would have to allocate from the free-store for every field.
It would no longer be possible to create an actual array. You'd always get an array of handles.
Java already provides this feature it was introduced a while back it's called auto-boxing and unboxing which automatically wraps and unwraps int to Integer and vice versa whenever a primitive is passed when an Object is expected or when an Object is passed when a primitive is expected.
public static void main(String args)
int appleCount = 10;
System.out.println("You have " + appleCount + " apples");
Why would this syntax need to change? You could also have String number = 10.toString();. I'm sure that you realize there is already not a one to one mapping from syntax to code. The for ( String s : strings) is clearly one example of this. So the above example could be swizzled to "Integer.toString(10);" by the compiler.So I don't see why you'd have to change the syntax to support treating primitives as objects in the language but have them as primitives in the run time. Smalltalk does this.. they are called immediate directs.
As said in reply to Shannon, Java already provides this feature, removing primitive types makes this feature redundant so it would likely be removed along with the primitives.
I can't justify removing primitives from Java so I am not going to defend the idea, I posted this thread because I was looking for an explanation as to why this would be suggested and what ramifications there would be as a result. I was curious to know if it seemed counter intuitive to anyone else so I asked if primitives were needed by programmers. i personally use primitives where they make sense, i.e. where I don't need an Object but the suggestion that appears to be made is that people want Java to become a language where everything really is an Object.