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