From: ········@bayou.uh.edu
Subject: Re: C++ briar patch (Was: Object IDs are bad)
Date:
Message-ID: <5lo3pd$gar$1@Masala.CC.UH.EDU>
Hrvoje Niksic (·······@srce.hr) wrote:
: ········@Bayou.UH.EDU (········@bayou.uh.edu) writes:
: > I think the question goes further to "do we even need to obtain and
: > dereference them?". I'm using Scheme, and before that Haskell -- 2
: > languages without pointers, and I've yet to run into a situation
: > where I even remotely missed them much less thought about them.
: Are you sure you and Erik agree on the definition of a pointer?
Well I'm assuming we do since he made mention of "dereferencing"
a pointer, but then maybe we don't agree on the definition of
"dereference" :).
: Consider, for example, the Lisp expression:
: (setq foo (vector 1 2 3))
: The variable FOO could be regarded as a pointer to a vector. By
: accessing it, you are dereferencing the pointer. The only difference
: between FOO and a pointer in C is that you cannot pretend that FOO has
: inherent arithmetic properties.
Ok, then I'm thinking of a different definition of pointer. I'm
thinking of C style pointers -- more low level, more dangerous,
more pervasive. Something like the above, while not something
I'd do (I use functional techniques), is not something I'd find
particularly troubling.
[Snip]
: This is because FOO and BAR now point to the same object. Indeed
: there is very little difference between this, and:
: char *foo = strdup ("string");
: char *bar = strdup ("string");
: ...where the expression `foo != bar' will yield 0, and you can assign
: values foo to where bar points to, etc.
Ok, I was thinking something different then. Again I was thinking
of pointers with their associated "uses" (ie: memory allocations),
their problems (dangling, NULL dereferences), etc... When I made
mention of pointers, I was speaking in reference to C++ but I
can see how this ambiguity managed to confuse the issue. Thank
you for the clarification and I hope what I meant is more explicit.
: I don't know about Haskell, but Lisp (and presumably Scheme) certainly
: does possess an abstraction of pointers, even if they are not named
: thus.
Haskell doesn't possess this feature -- at least not that I know of.
Since it's a purely functional language, it avoids all sorts of
mutability and assignments (other than value bindings), so the
closest you'd get is the dynamic allocation/deallocation of
memory -- pointers behind the scenes.
Again thank you for clarifying things to me and sorry about the
confusion.
: --
: Hrvoje Niksic <·······@srce.hr> | Student at FER Zagreb, Croatia
: --------------------------------+--------------------------------
: I'm sure they'll listen to reason! -- Neal Stevenson, _Snow Crash_
--
Cya,
Ahmed
And I know she must think I'm screwed,
That I'm only interested in food,
But when I looked deep into her eyes,
I wanted more than a burger and fries.
"Burger King Queen" by the Queers
From: Hrvoje Niksic
Subject: Re: C++ briar patch (Was: Object IDs are bad)
Date:
Message-ID: <kigpvuo8h6j.fsf@jagor.srce.hr>
········@Bayou.UH.EDU (········@bayou.uh.edu) writes:
> Ok, then I'm thinking of a different definition of pointer. I'm
> thinking of C style pointers -- more low level, more dangerous,
> more pervasive. Something like the above, while not something
> I'd do (I use functional techniques), is not something I'd find
> particularly troubling.
Actually, your definition of pointer differs from what I showed above
in only one respect: C pointers have arithmetic properties (meaning
that you can make them point anywhere you want), which I believe was
Erik's point.
--
Hrvoje Niksic <·······@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
I'm a Lisp variable -- bind me!