librelist archives

« back to archive

POINTER features

POINTER features

From:
Paolo Redaelli
Date:
2011-10-22 @ 21:41
Shouldn't a POINTER be COMPARABLE?
I know we shall avoid pointers whenever possible and the fewer the
features it has the better, but there are situations when you just can't
work it out with out them, provided that you don't want to rely on C code.

I looked at ISE implementation
(http://doc.eiffel.com/static/libraries/base/pointer_chart.html)
founding a something that seems to ask not to be used except in dealing
with C code, i.e. almost feature-less.

Yet I can't see why POINTER shouldn't be COMPARABLE except following the
taboo "Eiffel does not dirt itself with low-level issues".

Another issue is:  shoulnd't it have infix "-" (another: POINTER) so you
may write
infix "+" (offset: INTEGER): POINTER is ...
    ensure Result-Current = offset
I wonder why no one ever noted that using a plain integer as offset is
somehow wrong, since it cannot span all the addressable memory. Let's
speak of 32 bit machines: an int goes from -2^31 to 2^31-1 AFAIR so
given an arbitrary pointer x with x+an_integer we cannot reach all the
addressable space.
Solving this issue may require several changes.... I'm thinkering about
them...

Please forgive me for this as it resemble too much a rant...