[OT] Strong/Weak/Dynamic/Static typing (was Re: Python Strings)

Martijn Faassen m.faassen at vet.uu.nl
Mon Sep 25 09:41:26 EDT 2000


Jonadab the Unsightly One <jonadab at bright.net> wrote:
> m.faassen at vet.uu.nl (Martijn Faassen) wrote:
[snip me trying to comprehend inform and detailed answers]

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

> Actually, they're not really exposed to the casual programmer;
> the Designer's Manual doesn't talk about them really.  I know 
> about them because I've read the technical manual and the 
> specification of the z-machine and no small number of related
> technical discussions on rec.arts.int-fiction.

Ah, I see, Inform is a language for interactive fiction! Interesting..

> As far as the
> casual programmer is aware, you can simply do something like
> the code below.

> Notice that the description property of one
> object holds a string, and the description property of the 
> very next object holds a routine (which executes a rather
> lousy joke I shamelessly ripped off from Graham Nelson for
> the sake of the example, but nevermind).  When the library
> is ready to print the description of the first object, it
> discovers a string and just prints it.  When it is ready
> to print a description of the second object, it discovers
> a routine and runs it.

Right, in Python you could do the same (by overloading __str__() for
instance).

In LPC (which is yet another C derived interpreted object oriented language
used in lpmuds (more interactive function) since the early 90s or late 80s even
-- and they called Java innovative :), you have the concept of 
'VBFC', which I believe stands for Variable By Function Call. You do
much the same thing with it; instead of having a string you can put a function
call in its place, even interpolated, I believe.

>  Since the routine returns true[1] 
> rather than false (which would be the default) it assumes 
> that the routine has printed something.  If the routine
> had not returned true, the library would have printed
> a default "You see nothing special about the spade."

Again similar to LPC, where if a function (method really) returns 1, the
attempt at parsing the command the player typed is taken to have succeeded.
You can optionally define a failure message in case true is not returned.
I wonder if Inform's evolution of this was independent or somehow related
to LPC? It may be a general pattern in languages like this. And though
both languages are object oriented, both don't seem
to use the normal OO techniques to accomplish this effect.. Interesting!

[snip]

> And here's an example of substituting a routine for an object...

[snip another example]

Yes, the solution in LPC to that problem (an exit with special behavior)
is quite similar.

[snip stuff about the z-machine; I recall reading about this]

> [3] MUCH more portability[4] than Python, but of 
>     course it has a cost in power.

Does Inform code compile to the average z-machine? I recall that lots of
z-machines have rather strict limitations on how much memory objects
[snip]
>     There is also
>     now a newer VM (glulx) which kicks out all the
>     size limitations a few orders of magnitude
>     and supports sound and graphics and I think 
>     limited file I/O; it will still be more portable 
>     and less powerful than Perl or Python.

Does glulx still port to the old machines you mentioned too, though?
If not then Python may not be much less portable.

[snip]

> [7] The low addresses (which are not packed) are 
>     RAM, and the packed addresses are ROM.
>     So all strings and routines are in ROM, but 
>     all objects reside in RAM.

You can't put them in physical ROM though. I presume you mean that strings and
routines are in (to the z machine) immutable memory. Do they use the term
ROM for this?

[types in Inform are partially distinguished by address range]
>     It's a kludge, but it works, and
>     it lets the compiler, library, and indeed the
>     program see distinctions that apparently the 
>     VM was not designed to see.

I wonder why Inform didn't take the approach of putting the distinctions
within the object, instead of in the references (like Python does).

[snip]
> [9] I know these footnotes don't appear in order.
>     I didn't write the post in order.  I usually
>     don't write straight from beginning to end.
>     Besides, there is no footnote 9.

Thanks for all the interesting information. I should check out Inform and
z-machine, if only perhaps to steal ideas. :)

Regards,

Martijn
-- 
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