Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XP] why is Java's 'assert' a keyword?

Expand Messages
  • Kim Gräsman
    Hi guys, ... This is, more or less, what the .NET framework does. It has a framework attribute (whose name escapes me) that you can mark methods with.
    Message 1 of 12 , Jan 24, 2008
      Hi guys,

      On 1/23/08, Bill Kelly <billk@...> wrote:
      >
      > With a relatively static language like Java, I wonder
      > if they could have almost as easily added a keyword
      > to flag any method as debug_only, rather than making
      > the keyword the method itself.
      >
      > E.g.
      >
      > public debug_only void my_assert ( bool );
      >
      > ?

      This is, more or less, what the .NET framework does. It has a
      framework attribute (whose name escapes me) that you can mark methods
      with. Compilers are expected to omit calls to such methods in code
      generation in Debug builds.

      IIRC, there was a bug at one time, that one of the .NET compilers
      forgot to check the attribute, and so Debug.WriteLine was on in
      Release builds as well.

      - Kim
    Your message has been successfully submitted and would be delivered to recipients shortly.