Cover handler for a statement or a block of statements.

vincent vincent.risi at gmail.com
Wed Jun 8 12:06:10 PDT 2011


Cover handler for a statement or a block of statements.

I would like to suggest a method for defining code statement
covering. Some examp1es of a cover are as follows :-
  - try ... finally - this is defined in dotnet as a using
  - try ... (catch)+
  - cursor save and display others ... restore saved cursor

a possible syntax -

  cover hourglass(Application &app)
  {
    Cursor save = app.cursor;
	app.cursor = HOURGLASS_CURSOR;
	~ code ~
	app.cursor = save;
  }

usage could be something like -

  void function(Application &app)
  {
    hourglass(app)
    {
      ... // code to be run by cover
    }
  }


More information about the Digitalmars-d-learn mailing list