ahhhhh great explanation.  That will help a lot.  I found that annoying in
Java.

On Tue, Jan 13, 2009 at 1:38 AM, CuppoJava <[email protected]>wrote:

>
> Do you know Java? It'll be easier to explain if you do.
>
> In Java, everything is an Object. Object's are treated as references
> to a specific memory location which holds the actual data. So when you
> pass an Object to a method, you're only passing the method the memory
> location of that Object.
>
> For performance reasons Java has primitives. It makes little sense to
> pass a memory-location of an integer to a method, when the memory-
> location itself takes up the same number of bits as an integer. So
> primitives are passed to methods directly by value.
>
> Unfortunately, most of the standard API is written around Objects.
> Vectors, Lists, Maps, all are collections of Objects. If you wish to
> put a primitive in a Vector, you must first create a Object that wraps
> around the primitive.
>
> ie. class Integer {
>       int i;
>     }
>
> This lets you use primitives with the standard API.
>
> The process of wrapping a primitive up into a object is called boxing.
> The reverse is called unboxing. And when Java does it automatically
> for you, it's called autoboxing.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" 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/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to