ir230@sdcc6.ucsd.edu (john wavrik) (06/06/90)
ABOUT MEMORY
I've looked over the memory words that Mitch Bradley posted and I must
admit both surprise and pleasure that we are talking about something a
lot less radical than I had expected.
I hosted the ANSI meeting in January. I remember one day when I came
back from class to find the team heatedly debating the memory words. I
sat there for a few hours, then had to leave to teach again. When I
got back they were still at it and the debate was in progress when I
went home for supper. I had been promised a copy of BASIS 11 as
repayment for my work as host -- but never received it. So only now
have I found that the debate culminated in 8 words which can be coded
(using F83) in three screens. Something easily added to the system of
anyone who wants it and something which doesn't have to be there for
those who don't.
Taking F83 as an example, the words which pertain to memory
addressable by store, fetch etc. would be given trivial definitions
(since all the directly addressable memory is already available, I
assume that ALLOCATE, FREE and RESIZE are intended to give error
messages and AVAILABLE to return 0). FAR-ALLOC and FAR-FREE are just
DOS interrupt 21 functions 48 and 49. FAR-IN and FAR-OUT are just
intersegmental block moves.
The comments I made about memory allocation schemes still apply:
different applications can require different storage management
techniques. An important asset of Forth is that storage management
techniques can be tailored to the application.
I would like to add to that -- the proposed ANSI memory words will
still require most programmers to write (or use) their own storage
management schemes. After the January meeting, I played with MS-DOS
memory allocation long enough to convince myself that it was never
intended to be a heap management system for data. It was intended to
be used in a stack-like fashion for programs. It is just not
sophisticated enough for applications which randomly demand and
release variable size blocks of data -- it has no compaction and it is
too easy to fragment the memory. The proposed ANSI wordset is
therefore intended to get you a chunk of memory -- and your
application will still supply the appropriate storage management. It
will be important to make sure that sophisticated storage management
techniques can be written portably.
John J Wavrik
jjwavrik@ucsd.edu Dept of Math C-012
Univ of Calif - San Diego
La Jolla, CA 92093