If Java doesn't have pointers...
how come it has a NullPointerException?
"What I want to know is, does it really matter?"
just cause you can't manipulate them doesn't mean they ain't there.
it's just semantics
When people say "Java doesn't have pointers", they mean these pointers:
Which is a bit of a b*stard in some ways. If you want to pass an array of "somethings" to a function you also need to pass an offset. In C you could just use a pointer to the place in the array where it starts and Bob's your uncle (again; he gets around a bit does your uncle).
Well, I just pass around java.util.List's. Haven't used an Array in ages. But whatever floats your boat ;)
Pass an offset vs a Pointer? What's the difference? You're passing one extra parameter either way.
name withheld out of cowardice
He meant that instead of calling
bigoted against java
Because Java does have 'references', which are a type-safe way of doing what pointers do for C. In C, when you throw around pointers, you are actually throwing around actual addresses to variables stored in memory space. A 'null' pointer actually points to the real location zero in your memory space. Trying to access that location usually results in a memory permission violation error.
From one point of view, all references are really "pointers" behind the scenes.
Two words: Leaky Abstraction.
That's NOT a leaky abstraction.
Sure it is... it's an implementation detail (oh, references are implemented as pointers?! gosh!) that's peaking through.
That's a pretty generous definition of "leaky".
Sure.. but it's also pretty stupid to have a null pointer exception when the entire language specification makes absolutely no mention of the word "pointer".
Shall we discuss the stupidities in PHP? :)
'the entire language specification makes absolutely no mention of the word "pointer"'
Hehe.. so they say "...special null reference..." but the exception is still null pointer.
"Shall we discuss the stupidities in PHP? "
Just me (Sir to you)
In all fairness, I believe the original 'idea' of a 'pointer' came from Pascal. It was C that turned the 'idea' into an implementation where a 'pointer' became a literal address on the machine -- and then made the only way you could change the value of a parameter in a subroutine was to pass the subroutine a pointer to the parameter.
The first pointers I saw were in assembler.
Fog Creek Home