Path: utzoo!mnetor!tmsoft!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!rice!bbc From: bbc@rice.edu (Benjamin Chase) Newsgroups: comp.lang.modula3 Subject: Re: Questions from a new advocate of Modula-3 Message-ID: Date: 8 Feb 91 13:42:27 GMT References: <9102080401.AA29237@jumbo.pa.dec.com> Sender: news@rice.edu (News) Reply-To: Benjamin Chase Organization: Center for Research on Parallel Computations Lines: 39 In-Reply-To: gnelson's message of 8 Feb 91 04:00:50 GMT gnelson (Greg Nelson) writes: >Here are answers to some questions from Darren New: > 2) The NEW expression's behaviour is not defined in the case that > not enough memory is left. Is this a checked runtime error, or > does it return NIL? If it returns NIL, then it isn't returning > a "new" value. If it is a checked runtime error, how do you > allocate all available memory without crashing? I think this is the wrong decision. Darren and the previous people asking this same question have a very good point. There should be a standard (ie. not implementation-dependent) way to safely allocate memory. It shouldn't have to blow your program out of the water to let you know that there was no available memory. There should be a way to get NEW to raise an exception. >The report should have defined this to be a checked runtime error. >If you want to allocate all available memory without crashing, you >have to use a lower-level, implementation-dependent interface. > 7) Has an "assert" capability been considered? Maybe preconditions > and postconditions could be included. It seems like this would > make for a much "safer" situation where an unsafe module exports > a safe interface. Asserts in interfaces could help document > the semantics of the interface. >SRC Modula-3 has an ASSERT pragma. Perhaps another required module instead of, or in addition to, an ASSERT pragma? Yeah, I think I know why the pragma; you want the compiler to evaluate the predicate if it can, and generate a compile-time "assertion-botched" message. This does have its selling points. People are more likely to use assertions if they feel that there is no run-time penalty. Sigh. ps: Greg, my mailer couldn't easily reply to your posting... -- Ben Chase , Rice University, Houston, Texas