home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / modula3 / 904 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.7 KB  |  45 lines

  1. Newsgroups: comp.lang.modula3
  2. Path: sparky!uunet!cs.utexas.edu!mercury.unt.edu!ponder!ryan
  3. From: ryan@ponder.csci.unt.edu (Ryan Stansifer)
  4. Subject: Syntax of WITH and TRY
  5. Message-ID: <ryan.716070235@ponder>
  6. Sender: usenet@mercury.unt.edu (UNT USENet Adminstrator)
  7. Organization: University of North Texas
  8. Date: Wed, 9 Sep 1992 20:23:55 GMT
  9. Lines: 34
  10.  
  11. After programming some in Modula-3 I have come to think that the WITH
  12. and TRY statements are wordy, especially in conjunction with other
  13. blocks.  In thinking about the language syntax it occurred to me that
  14. some simplification may be possible.  So, for the sake of argument I
  15. offer the following 2 suggestions for expanding the block statement to
  16. encompass both the WITH and the TRY statements.
  17.  
  18. Instead of
  19.     WITH x = e DO S END
  20. add a new kind declaration, say, WITH.
  21. Now we write:
  22.     WITH x = e BEGIN S END
  23. Now we can mix VAR, CONST, WITH declarations and use only one
  24. BEGIN/END block.  I think the WITH declarations should be separated
  25. by semicolons like other declarations.
  26.  
  27. (There is another, perhaps more important, issue.  WITH declarations
  28. seem to be used in two distinct ways.  One, as READONLY constant
  29. r-values.  Two, as aliases.  Adding READONLY constants is
  30. unproblematic, but I would hate to add a new "alias" declaration when
  31. they are really READONLY constants of type reference, reference in the
  32. C++ sense.)
  33.  
  34. Instead of
  35.     TRY S EXCEPTION Handler END
  36. we could follow the example of Ada and tack on an exception part
  37. to the block.  Now we write
  38.     BEGIN S EXCEPTION Handler END
  39. This permits declarations can be added to the block without
  40. extra BEGIN/END pairs.
  41.  
  42. I do not wish to touch off another language-changing war.  I'm just
  43. curious about the advantages and disadvantages of different approaches.
  44.  
  45.