Andreas Plesner Jacobsen wrote:
> On 2006-09-20, Peter Wing Larsen <peterwing@mail.dk> wrote:
>> Hvad er ideen bag at have primitive typer + wrapper klasser til disse
>> proppet med statiske metoder? Hvorfor har man ikke bare lavet de primitive
>> typer til _rigtige_ objekter? Hastighedsårsager? Heap-allocation issues?
>
>
http://www.artima.com/intv/gosling313.html
>
> Bill Venners: Why are there primitive types in Java? Why wasn't
> everything just an object?
>
> James Gosling: Totally an efficiency thing. There are all kinds of
> people who have built systems where ints and that are all objects. There
> are a variety of ways to do that, and all of them have some pretty
> serious problems. Some of them are just slow, because they allocate
> memory for everything. Some of them try to do objects where sometimes
> they are objects, sometimes they are not (which is what the standard
> LISP system did), and then things get really weird. It kind of works,
> but it's strange.
>
> Just making it such that there are primitive and objects, and they're
> just different. You solve a whole lot of problems.
C# synes at have fundet en udmærket løsning.
Og med auto boxing/unboxing i Java 1.5 fungerer Java lidt
på samme måde, bare mere klodset lavet.
Arne