[M3devel] Unbounded but finite LONGINT (was: Re: Integers

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Sat Jan 9 04:00:41 CET 2010


On Fri, Jan 08, 2010 at 09:32:47PM -0500, Tony Hosking wrote:
> On 8 Jan 2010, at 20:33, hendrik at topoi.pooq.com wrote:
> 
> > On Fri, Jan 08, 2010 at 07:53:07PM -0500, Tony Hosking wrote:
> >> I think what you are advocating is Rodney's proposal + assignability 
> >> of INTEGER and LONGINT + mixed arithmetic.
> > 
> > I thought Rodney's propsal still had the compiler impose a bound on the 
> > size of LONGINT.  Or did I miss something?
> 
> Yes, it would.
> 
> > I'm proposing to let the programmer use subranges of LONGINT that are as 
> > long as he wishes.  And if the computer runs out of virtual memory to 
> > store one of the programmer's long integers, well, that's the computer 
> > imposing the limit, not the language.
> 
> But there is still the question as to what *representation* is used to decide the particular operation to apply.
> 
> I suppose the compiler could choose a particular machine 
> representation based on the range of values in the subrange (much as 
> it does currently).

That's exactly what I propose.

> But if you really want to have an arbitrary range type I would argue 
> it is much better to implement it as a library than as a primitive 
> type.

That's fine if I have no static limit on the size of the integers.  Like 
if I want to have an open array.  Or even an array that I can resize 
dynamically.  But for the common case where I know exactly what the 
limits are, static is better.

(and that's the case with file offsets, for example)

What's easier for the compiler writer is another matter, of course.

> 
> Just for fun, I suggest you take some time to watch the talk Growing a 
> Language, by Guy Steele

I'll try and find it.  I seem to remember seeing the text somewhere.

-- hendrik



More information about the M3devel mailing list