Article View: comp.lang.modula2
Article #999Re: Implementing Abstract Lists
From: Juergen Boerstler
Date: Thu, 02 Aug 1990 14:58
Date: Thu, 02 Aug 1990 14:58
53 lines
3237 bytes
3237 bytes
mbenveni@irisa.fr (Marc Benveniste) writes:
>From article <290@saxony.pa.reuter.COM>, by dgil@pa.reuter.COM (Dave Gillett):
>>
>> So I'm looking for a simple, and preferably portable, way to (a) calculate,
>> and (b) use, the offset. Pointer arithmetic is possible, but I'm developing
>> on the PC so that approach may not be simple or portable. Any suggestions?
>I have used the following interface to optain genericity and still rely
>on Modula-2 strong typing. Portability is isolated in the SYSTEM and
>Storage modules. I'm sorry for posting sources, but I hope these sources
>can be useful to many.
>... implementation deleted
I cannot see where this approach relies on the (relatively) strong typing
of Modula-2, nor is it very portable (if at all). The following list of
problems can be stated:
(1) List elements have to be passed per 'ADDRESS' (-> limited type checking,
because all pointers (and CARDINAL usually) are compatible with it).
(2) The implementation has an elegant solution to the problem of copying
bytestrings, namely not showing their implementation (-> limited
portability, because "standard" Modula-2 only can deal with words of
memory, which have an implementation dependent size. Therefore copying
values of "length MOD bytesPerWord <> 0" is very tricky in most Systems).
(3) The interface is not comprehensive enough (-> limited usability, because
a lot of ressources are not present, e.g. 'InsertBeforeGivenElement',
'IsGivenElementInList', 'LengthOfList', ....).
(4) There are no procedure parameters to the ressources (esp. 'NewList'
-> see (3), because procedure parameters are needed for some of the
more advanced features, e.g. 'SortList', 'DeleteDuplicates', ...).
(5) More suggestions?
In my opinion the approach attemted by C. Lins in
'The Modula-2 Software Component Library' (by Springer)
is a good way to obtain generic adts in Modula-2 without enlarging the
language. But there are also some very interesting discussions about
adding generic (and object oriented) constructs/ features to the language,
which can be checked and filtered by preprocessors.
It would be very nice to have a discussion about such extensions including
preprocessors to "standard" Modula-2.
jubo
**************************************************************************
* Juergen Boerstler * e-mail: jubo@rwthi3.uucp *
* Lehrstuhl fuer Informatik III * *
* Ahornstrasse 55 * phone: +49/ 241/ 80-7216 *
* D-5100 Aachen * *
* West Germany * *
**************************************************************************
Technical Details
Message-ID:
<3275@rwthinf.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!unido!rwthinf!juboReferences:
<290@saxony.pa.reuter.COM> <1990Aug2.092218.23731@irisa.fr>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!unido!rwthinf!jubo From: jubo@rwthinf.UUCP (Juergen Boerstler) Newsgroups: comp.lang.modula2,comp.edu Subject: Re: Implementing Abstract Lists Message-ID: <3275@rwthinf.UUCP> Date: 2 Aug 90 14:58:59 GMT References: <290@saxony.pa.reuter.COM> <1990Aug2.092218.23731@irisa.fr> Followup-To: comp.lang.modula2 Organization: RBI - RWTH Aachen Lines: 53