Re: [Vala] Idea: Change escaped comments to Logger calls



I find thay my debug statements are more helpful that my comments; my comments explain what I'm trying to do, by debug statements explain what is being done and why.

Debug stataments by definition and out of necessity help one understand the code flow.

But why not just write a debug statement instead of a special comment? It's the care in crafting a debug statement that makes it so useful.

Sam



From: Endi <endi123 gmail com>
Sent: 05 April 2009 03:04
To: vala-list gnome org
Subject: [Vala] Idea: Change escaped comments to Logger calls



Usually a programmer writes comments about what the next few code lines will do. When something goes wrong, stdout.print() or Glib.debug() lines are also inserted for debug purposes:

// Opening a file
Glib.debug("Opening a file");
...
code block
...

It isnt a good thing document something twice, so I advise the following syntax for this:
//$ Opening a file
...
code block
...

Then in C, the comment line would change to:
g_debug("Opening a file");

Other suggestions:
//$ = //$D = Debug
//$W = warning
... and so on

I used the "$" character there, because it reminds me to the bash prompt (where the messages will be shown), but anything goes.

People would really use it and like it, because it is much more handy than stdout.print an the others. IDEs could show these with different colors (like comments), so logger calls could separate from valuable code.

What do you think, is this a good idea?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]