Could we have the debug statement like this:
Debug [DebugLevel, ] <expression>
instead of our traditional
Debug <expression> [, DebugLevel]
, please?
That way, (especially when debug statements have long, complicated expressions to contend with )
* it would look more tidy
* the debuglevel assignment of debug statements would be immediately visible, as opposed to having to scroll to the code line's end;
* it would be easier to apply [mass-] changes to the debuglevel assignment of debug statements
* it wouldn't break programs' functionalities
* if made optional by an additional statement like - say - "EnableDebugLevelFirst",
harm to existing program code using "traditional" debug lines is being prevented, if that statement is simply not issued.
(Not sure how people go about their debug lines in their code once a program is considered "finished", I usually throw the debug lines out )
Debug [DebugLevel, ] <expression>
-
- User
- Posts: 92
- Joined: Sun Oct 24, 2004 9:25 am
Debug [DebugLevel, ] <expression>
Is this an artifact or should it be disposed of ?
Re: Debug [DebugLevel, ] <expression>
If the Debug statement is on its own line, then that line isn't compiled into the final executable and you don't need to do anything (or throw them out).Captn. Jinguji wrote: ↑Mon Sep 20, 2021 11:10 am(Not sure how people go about their debug lines in their code once a program is considered "finished", I usually throw the debug lines out )
-
- User
- Posts: 92
- Joined: Sun Oct 24, 2004 9:25 am
Re: Debug [DebugLevel, ] <expression>
I know that ^^
But the debug lines clutter tbe view, unnecessarily.
But the debug lines clutter tbe view, unnecessarily.
Is this an artifact or should it be disposed of ?
Re: Debug [DebugLevel, ] <expression>
I wonder if this DebugLevel command is really used much.
I only use DebugLevel in Include Files. Otherwise I only comment out debug statements that are not currently needed. You never know when you will need them again.
Until it is implemented you can also achieve the desired similar result with the help of a macro:
But I think you know that yourself.
I only use DebugLevel in Include Files. Otherwise I only comment out debug statements that are not currently needed. You never know when you will need them again.
Until it is implemented you can also achieve the desired similar result with the help of a macro:
Code: Select all
Macro MyDebug(Level, Message)
Debug Message, Level
EndMacro
But I think you know that yourself.
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
-
- User
- Posts: 92
- Joined: Sun Oct 24, 2004 9:25 am
Re: Debug [DebugLevel, ] <expression>
Yes, Axolotl, I do know, but thanks anyway.
I think the usefulness of debuglevel is dependant of what you do.
It may well be that many fellow programmers never use it, but keep to simple "debug <expression>" lines.
They wouldn't have to change a thing if my proposal really got implemented.
But once one gets the hang of it ...
In my case, one application, for example, is the processing of texts from YT comments (as a an easily available sample source ),
passed through many stages of filters and processors.
It is really sometimes outrageous what people do to mistreat texts in order to express how oh so creative they (believe they) are.
As the philosopher put it: NEVER assume you can curb imbecility, the idiots are way too resourceful.
Thus, b..sh.t suddenly turning up in the final output may have been (re-)induced on any given previous stage,
And then having to de-comment umpteen debug statements is not funny.
I think the usefulness of debuglevel is dependant of what you do.
It may well be that many fellow programmers never use it, but keep to simple "debug <expression>" lines.
They wouldn't have to change a thing if my proposal really got implemented.
But once one gets the hang of it ...
In my case, one application, for example, is the processing of texts from YT comments (as a an easily available sample source ),
passed through many stages of filters and processors.
It is really sometimes outrageous what people do to mistreat texts in order to express how oh so creative they (believe they) are.
As the philosopher put it: NEVER assume you can curb imbecility, the idiots are way too resourceful.
Thus, b..sh.t suddenly turning up in the final output may have been (re-)induced on any given previous stage,
And then having to de-comment umpteen debug statements is not funny.
Is this an artifact or should it be disposed of ?
Re: Debug [DebugLevel, ] <expression>
This code currently currently outputs '1'
After your change it will output nothing without any error, warning or hint. It silently breaks [debugging-]code just because you like the parameters the other way around. There is no way they would even consider this.
Code: Select all
#val = 1
#dl = 2
DebugLevel #dl
Debug #val, #dl
-
- User
- Posts: 92
- Joined: Sun Oct 24, 2004 9:25 am
Re: Debug [DebugLevel, ] <expression>
It wouldn't , but if you cannot or are unwilling or unable to read and understand more than a single line of text at a time, that's not my problem.
Is this an artifact or should it be disposed of ?
Re: Debug [DebugLevel, ] <expression>
With EnableDebugLevelFirst it wouldn't, that's right. I hope you never design a language though. It's bad if you have to look for an EnableDebugLevelFirst in all the previous code to know what a Debug statement actually does.