Continuing the interesting discussion on languages with and without
extensive runtime library support:
Richard Matthias writes:
> Yes, I am aware of the difference between interpreted and compiled languages.
> I am aware that Poplog pop11 is compiled, but how much code does the compiler
> generate for say an = operator? Does it insert all the code do the key
> checking of the operands to make sure they are numeric, do the necessary type
> conversions etc. or does it just call a common library for these functions? I
> fear it does the latter. If the compiler just generates multiple calls to a
> massive library of code that must be present to run the program, then it might
> as well be interpreted! Or you might as well interpret the syspop. Well, maybe
> thats a bit harsh, but you get the idea.
Richard appears to be comparing the C operator "==" with the Pop11
operator "=" which is inappropriate because of the mismatch of
functionality. The more natural comparison is with Pop11's "=="
operator which does generate a simple machine code fragment.
The code fragments generated tend to be slightly more longwinded for
Pop11 because of the lack of parse trees and the requirement for
interactive, incremental compilation.
> Malloc doesn't manage the heap though. All it does is allocate memory. It
> can't grabage collect because it doesn't know who holds pointers to the
> pieces of memory it would have to move. Poplog on the other have can garbage
> collect because the run-time environment keeps track of all the identifiers
> and their associated values/pointers. This is what I mean by run-time
> environment.
Strictly speaking, malloc is part of a heap management system albeit
one that lacks the ability to automatically reclaim store. However,
the fuller heap management provided by Poplog (and Lisp and SML and ...)
does indeed require a great deal extra in terms of run-time support.
I think that this is the key distinction that Richard is trying to
define: the difference between languages with full automatic storage
management and those without.
This distinction is probably the most important characteristic of
any programming language. When confronted by a new programming language
I believe that one of the first questions a competent programmer
tries to answer is: "how is store managed?"
I believe that the distinction between languages with automatic and
programmer-directed store management is archaic. It is time for
programming languages to accomodate both techniques, so that programmers
are able to deliberately "free" store or let it be automatically
reclaimed as desired. Programming environments should come with tools
that allow programmers to determine the memory-usage of their
programs (e.g. to show that they will run in a garbage-free fashion,
or see how the size of units allocated is distributed.)
I would see this as an easy augmentation to Poplog and one that would
make it a more attractive programming vehicle for capable programmers.
Firstly, Poplog should be supplied with a -sys_free- function that
returns store to the managment system and constructors should be able
to take advantage of the freed store (although for performance reasons
this should be optional.) Secondly, there should be more procedures
for investigating the state of the heap: such as the amount of store
allocated and deallocated. Possibly this should be done by making the
constructors call some statistic gathering routines when -pop_debugging-
is <true>.
Steve
|