Re: a question about private access

From: James Dennett (jdennett_at_acm.org)
Date: 07/04/04

  • Next message: James Connell: "Re: a question about private access"
    Date: Sun, 04 Jul 2004 10:17:40 -0700
    
    

    James Connell wrote:
    > one borland C++ extention i woudn't mind seeing adopted into C++ is the
    > try{}catch{} finally{} which cause the "finally" block to be exectuted
    > even if an exception is thrown or not.

    This is discussed fairly regularly in the newsgroups.

    I think it has little chance of working, as deterministic
    destructors and the RAII idiom do the job more robustly --
    with finally, every client of the resource must remember
    to clean up, whereas with RAII only the author of the
    resource management class must do so. Duplication is a
    Bad Thing.

    Even C# improves on Java's finally mechanism by adding
    a structure which automatically disposes of IDisposable
    objects -- though my memory on this is hazy -- and as
    such gives further evidence that the Java approach is
    somewhat weak.

    That said, for quick and dirty pieces of code "finally"
    can be convenient. It's just that dirty and convenient
    is a bad idea in production quality code.

    -- James


  • Next message: James Connell: "Re: a question about private access"