[Cfp-interest] more try/catch precedents

Mike Cowlishaw mfc at speleotrove.com
Sat May 31 12:42:44 PDT 2014


Had hoped to read and respond in depth to this thread before leaving on a trip
tomorrow.  Too many other interrupts; sorry.

But one concept I'd like to mention: the "try" is a syntactic burden that in
C++, Java, etc., simply adds a layer of nesting.  Most languages already have
grouping constructs ({ }, do..end, loop..end, select...end, etc.).  There is no
need to add another layer of nesting -- any of those could support 'catch' (and,
actually, more usefully: 'finally') as part of the existing nesting/block
structure.

In pseudocode:

  loop // or select, or do, or for, etc. 
    .. some I/O or some FP operation(s) ..
  catch
    .. whichever exceptions ..
  finally
    .. cleanup after any of the above (e.g., close files, reset flags)
  end

NetRexx (which emits Java source code with its plethoroa of tokens and nesting)
is an example of this.

Mike



> -----Original Message-----
> From: cfp-interest-bounces at oakapple.net 
> [mailto:cfp-interest-bounces at oakapple.net] On Behalf Of David 
> Hough CFP
> Sent: 31 May 2014 14:21
> To: cfp-interest at ucbtest.org
> Subject: [Cfp-interest] more try/catch precedents
> 
> 
> In a quick look I found that matlab, perl, and php also have 
> try/catch.
> 
> In Ruby, try/catch/finally looks like begin/rescue/ensure - 
> in other words, any begin/end block can have rescue clauses 
> attached, no need for a "try"
> keyword - and it also has a feature that I didn't notice 
> elsewhere, an "else" clause that runs after the main block if 
> no exceptions were caught.
> 
> And Silverfrost (formerly Salford) Fortran for .NET has a 
> try/catch extension too, that seems to be like that in Lahey 
> Fortran for .NET
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
> 



More information about the Cfp-interest mailing list