Python Strings

Jonadab the Unsightly One jonadab at bright.net
Fri Sep 22 17:41:47 CEST 2000


"John W. Baxter" <jwbnews at scandaroon.com> wrote:

> > I'm not sure I understand this. Does this mean you have addresses here
> > as well, but in a fixed range (or array indices, if you like).
> 
> The way I've seen this done is to restrict the range of integer, and use 
> the bits at one end or the other as a type indicator.  Often the low end 
> is used and pointers (and their objects) are constrained to suitable 
> address boundaries.  Often the high end is used and part of the address 
> space is "lost".

This is not the case with Inform, however.  If you were doing
a lot of math you could create an integer class, of course,
or even a float class, although because of VM limitations
you would have to create[1] every integer or float object 
at compile time (although their values could change at
runtime, since objects are mutable).  You could then test
with if (foo ofclass mynumclass) or whatever.  Normally, 
integers as such are only used in certain known cases --
certain properties (like number) are just expected to
contain an integer (if they exist at all), but it does
not make sense for a description (say) to be an integer.  
Usually an integer is actually a reference to something 
else -- say, an object -- if it isn't a packed address.
And of course the range of integers that refer to objects 
is limited by the possible number of objects, which will 
always be less than the smallest packed address.

So, basically, the internal structure of Inform is
pretty weird.  As I said, this is clearly not strong
or static typing, but I'm not sure it's weak or 
dynamic typing as such either.  It's very different
from the way Perl handles typing, for example.

[1] Or at least account for.

- jonadab



More information about the Python-list mailing list