Article View: comp.lang.modula2
Article #2212Re^2: Generic stack implementation
From: Guenter Dotzel
Date: Thu, 17 Dec 1992 08:14
Date: Thu, 17 Dec 1992 08:14
68 lines
3320 bytes
3320 bytes
Message-Id: <01.23294@ame.nbg.sub.org>
EEPJM%WOMBAT.NEWCASTLE.EDU.AU@USENET.ZER wrote on Tue, 12-15-1992 at 23:47 h
under the subject 'Re: Generic stack implementation':
> I know that Wirth's original idea was that uses of SYSTEM should be
> rare, so that importation of SYSTEM should act as a marker that
> something suspect is being done; but IMO this has failed because:
> (a) there are some non-portable features which were (accidentally?)
> left out of SYSTEM - e.g. address arithmetic, type BITSET,
Both problems solved by ISO_M2:
1. Address arithmetic can only be done by SYSTEM.(ADDADR, SUBADR, DIFADR).
2. A new keyword PACKEDSET in addition to SET was introduced in ISO_M2
to be able to declare a type such as BITSET.
TYPE BITSET = PACKEDSET OF [0..SIZE(BITSET)*8-1];
The type BITSET is still pervasive and is not in SYSTEM (as in PiM).
> type casting - so that it's possible to write non-portable code
Solved by ISO_M2's SYSTEM.CAST (T, expr).
PiM's form T(expr) cast is no longer allowed.
> without ever importing from SYSTEM. This is especially evident
> among programmers who learnt C before learning Modula-2.
You shouldn't learn C before Modula-2! This has to be guaranteed by
those who are responsible for programmers' education. :-)
> (b) SYSTEM is too big, and contains some things that don't belong
> there. Every man and his dog ends up importing from SYSTEM,
> so that uses of SYSTEM no longer stand out as being something
> unusual.
> The solution, I believe, is to break up SYSTEM into a set of smaller
> low-level modules, to give the reader of a source listing a better
> idea of what low-level features are being used. (Many M2 implementations
> already do this to a limited extent. For example, it's become common
> to put TRANSFER/IOTRANSFER in a module other than SYSTEM. This is a
> good example of something which didn't belong in SYSTEM in the first
> place.) The low-level features of Modula-2 are certainly worth
> keeping (otherwise you drive people like me towards C and possible
> suicide), but their uses need to be flagged in a more visible way.
Already done in ISO_M2. SYSTEM is now very small, although individual
implementations are allowed to extend it. ISO_M2 has several
additional system modules for
-library exceptions,
-language exceptions,
-termination, and
-coroutines.
> One obvious approach, by the way, is to have a compiler option to
> generate warning messages for things which might be non-portable
> - e.g. type-casting. Strangely, I've never seen a M2 compiler
No warnings needed in ISO_M2.
Guenter Dotzel,
ModulaWare GmbH, Wilhelmstr. 17A, D-W 8520 Erlangen/F.R.Germany
Tel. +49 (9131) 208395, Fax +49 (9131) 28205.
E-mail/Internet: 100023.2527@compuserve.com
g_dotzel@ame.nbg.sub.org
Technical Details
Message-ID:
<4v2y7Ohz85@tron.gun.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!easix!tron.gun.de!g_dotzelShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!easix!tron.gun.de!g_dotzel From: g_dotzel@tron.gun.de (Guenter Dotzel) Newsgroups: comp.lang.modula2 Subject: Re^2: Generic stack implementation Message-ID: <4v2y7Ohz85@tron.gun.de> Organization: TRON Public Mailbox, Neurath, Germany Date: Thu, 17 Dec 1992 09:14:00 +0100 Lines: 69