Python Strings

Martijn Faassen m.faassen at
Wed Sep 20 18:12:30 CEST 2000

Jonadab the Unsightly One <jonadab at> wrote:
> Actually, this discussion has me trying to classify Inform's
> typing system, and I'm having trouble.  Perhaps if I describe
> its typing system you can tell me how to classify it...

Trying to figure it out now..

> Everything is an integer.  I'll explain.  If you assign an
> integer to a variable, that integer is literally stored in
> the variable itself -- so the variable actually holds the
> integer.

All right. So, in Pythonic syntax:

a = 1

Should behave similar to Python, though the implementation in Inform
seems different as no integer object is created.

>  If you assign anything *else* to a variable,
> the item itself is not stored.  An integer is stored.  For
> some kinds of things (strings, routines) the stored value
> is a packed address.

Okay, so in that case, variables are references to these objects.
How does Inform know whether a variable contains an integer or
an address? Does the variable name have a type associated too, or
is some other magic going on?

> For other kinds of things (attributes,
> properties, dictionary words, objects, classes, ...) the 
> value stored is a unique ordinal number.  (So, the first
> dictionary word that appears in the code will be 1, and
> so on.  The first property declared will also be 1.  And
> the first object.  Et cetera.)

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).

> So, if you have an object...

> Object foo "foo";

What's the "foo" bit about?

> And you give the object some attributes...

> give foo openable open container;

> You can copy those attributes to another object...

> for (i=1:i<=last_attribute:i++) 
>    if (foo has i) give bar i; 
>       else give bar ~i;

What does the 'give bar ~i' part do?

> Obviously that's not static typing, nor is it
> strong typing.  But is it weak, dynamic typing?

You can pull of things like this with Python as well. You can ask
what attributes an object has and copy them to another one.

> It's very different from the type system of, 
> say, Perl...  maybe it's yet some other kind
> of typing?  Or are "weak typing" and "dynamic
> typing" sufficiently general terms to include
> this system?

I think that is Perl's type system is similar to Python's you could
pull of some of this copying as well.

What Inform seems to do is expose some implementation details (addresses),
though I'm not quite sure how it could work internally yet..


History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?

More information about the Python-list mailing list