home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / modula2 / 1587 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  3.2 KB

  1. Path: 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
  2. From: g_dotzel@tron.gun.de (Guenter Dotzel)
  3. Newsgroups: comp.lang.modula2
  4. Subject: Re^2: Generic stack implementation
  5. Message-ID: <4v2y7Ohz85@tron.gun.de>
  6. Organization: TRON Public Mailbox, Neurath, Germany
  7. Date: Thu, 17 Dec 1992 09:14:00 +0100
  8. Lines: 69
  9.  
  10. Message-Id:   <01.23294@ame.nbg.sub.org>
  11.  
  12. EEPJM%WOMBAT.NEWCASTLE.EDU.AU@USENET.ZER wrote on Tue, 12-15-1992 at 23:47 h
  13. under the subject 'Re: Generic stack implementation':
  14.  
  15. > I know that Wirth's original idea was that uses of SYSTEM should be
  16. > rare, so that importation of SYSTEM should act as a marker that
  17. > something suspect is being done; but IMO this has failed because:
  18. >  (a) there are some non-portable features which were (accidentally?)
  19. >      left out of SYSTEM - e.g. address arithmetic, type BITSET,
  20.  
  21. Both problems solved by ISO_M2: 
  22.  
  23. 1. Address arithmetic can only be done by SYSTEM.(ADDADR, SUBADR, DIFADR).
  24.  
  25. 2. A new keyword PACKEDSET in addition to SET was introduced in ISO_M2
  26.   to be able to declare a type such as BITSET. 
  27.   
  28.   TYPE BITSET = PACKEDSET OF [0..SIZE(BITSET)*8-1];
  29.   
  30.  The type BITSET is still pervasive and is not in SYSTEM (as in PiM).
  31.  
  32. >      type casting - so that it's possible to write non-portable code
  33.  
  34. Solved by ISO_M2's SYSTEM.CAST (T, expr). 
  35. PiM's form T(expr) cast is no longer allowed.
  36.  
  37. >      without ever importing from SYSTEM.  This is especially evident
  38. >      among programmers who learnt C before learning Modula-2.
  39.  
  40. You shouldn't learn C before Modula-2! This has to be guaranteed by
  41. those who are responsible for programmers' education. :-)
  42.  
  43. >  (b) SYSTEM is too big, and contains some things that don't belong
  44. >      there.  Every man and his dog ends up importing from SYSTEM,
  45. >      so that uses of SYSTEM no longer stand out as being something
  46. >      unusual.
  47.  
  48. > The solution, I believe, is to break up SYSTEM into a set of smaller
  49. > low-level modules, to give the reader of a source listing a better
  50. > idea of what low-level features are being used.  (Many M2 implementations
  51. > already do this to a limited extent.  For example, it's become common
  52. > to put TRANSFER/IOTRANSFER in a module other than SYSTEM.  This is a
  53. > good example of something which didn't belong in SYSTEM in the first
  54. > place.)  The low-level features of Modula-2 are certainly worth
  55. > keeping (otherwise you drive people like me towards C and possible
  56. > suicide), but their uses need to be flagged in a more visible way.
  57.  
  58. Already done in ISO_M2. SYSTEM is now very small, although individual
  59. implementations are allowed to extend it. ISO_M2 has several
  60. additional system modules for 
  61.  
  62.   -library exceptions,
  63.   -language exceptions, 
  64.   -termination, and
  65.   -coroutines.
  66.  
  67. > One obvious approach, by the way, is to have a compiler option to
  68. > generate warning messages for things which might be non-portable
  69. > - e.g. type-casting.  Strangely, I've never seen a M2 compiler
  70.  
  71. No warnings needed in ISO_M2.
  72.  
  73. Guenter Dotzel, 
  74. ModulaWare GmbH, Wilhelmstr. 17A, D-W 8520 Erlangen/F.R.Germany
  75. Tel. +49 (9131) 208395, Fax +49 (9131) 28205.
  76. E-mail/Internet: 100023.2527@compuserve.com
  77.                  g_dotzel@ame.nbg.sub.org 
  78.  
  79.