digitalmars.D - add attributes to debug
- Gorge Jingale (14/14) Jul 24 2016 To allow for different debug versions without having to go full
- Ivan Kazmenko (8/12) Jul 24 2016 I don't get what would be the benefit.
- Gorge Jingale (13/26) Jul 24 2016 It's not complex to add and it saves more than a few characters,
- Adam D. Ruppe (4/6) Jul 24 2016 debug(whatever) thingy_here();
- Gorge Jingale (4/10) Jul 24 2016 You can't combine attributes:
- ag0aep6g (6/10) Jul 25 2016 [...]
To allow for different debug versions without having to go full blown version(). mem debug do something memory wise see debug write a message to console Then these different attributed versions can be disabled. it could be something like version(debug(see)) = none; or static if (hasAttribute(debug, mem)) disable mem; or from the command line or whatever. What makes this useful is we can easily assign different debug types(could be generalized to other versions(release, etc)) and not have to use version(longer and requires defines of the identifier).
Jul 24 2016
On Sunday, 24 July 2016 at 21:33:20 UTC, Gorge Jingale wrote:To allow for different debug versions without having to go full blown version(). mem debug do something memory wise see debug write a message to consoleI don't get what would be the benefit. Currently, you can write that like: version (debug_mem) {do something memory wise} version (debug_see) {write a message to console} In my opinion, saving a few characters here does not get anywhere near a good reason to add language complexity. Ivan Kazmenko.
Jul 24 2016
On Sunday, 24 July 2016 at 23:41:26 UTC, Ivan Kazmenko wrote:On Sunday, 24 July 2016 at 21:33:20 UTC, Gorge Jingale wrote:It's not complex to add and it saves more than a few characters, One can append attributes much easier to debug than version. That alone saves about 10 chars each statement, if there is, say 1000 debug statements in a typical smallish app, that's 10000 characters, quite a bit. One also has to consider the extra identifiers to add. That is around 20 chars each. It's also a bit more visual. It's also easier to remove attributes or change them. If one needs to change all debug attributes see to look, that involves about 10 keystrotes. If one has to do this to version, it is about 30. It already fits in with attributes... no extra complexity their.To allow for different debug versions without having to go full blown version(). mem debug do something memory wise see debug write a message to consoleI don't get what would be the benefit. Currently, you can write that like: version (debug_mem) {do something memory wise} version (debug_see) {write a message to console} In my opinion, saving a few characters here does not get anywhere near a good reason to add language complexity. Ivan Kazmenko.
Jul 24 2016
On Sunday, 24 July 2016 at 21:33:20 UTC, Gorge Jingale wrote:To allow for different debug versions without having to go full blown version().debug(whatever) thingy_here(); dmd -debug=whatever yourfile.d works today.
Jul 24 2016
On Monday, 25 July 2016 at 02:13:34 UTC, Adam D. Ruppe wrote:On Sunday, 24 July 2016 at 21:33:20 UTC, Gorge Jingale wrote:You can't combine attributes: mem see debug() { prints debug info } Attributes are useful are they not?To allow for different debug versions without having to go full blown version().debug(whatever) thingy_here(); dmd -debug=whatever yourfile.d works today.
Jul 24 2016
On 07/25/2016 04:16 AM, Gorge Jingale wrote:On Monday, 25 July 2016 at 02:13:34 UTC, Adam D. Ruppe wrote:[...][...]debug(whatever) thingy_here();You can't combine attributes: mem see debug() { prints debug info }debug(mem) debug(see) { /* ... */ } Though I'm not sure if the attributes in your example would have an AND or an OR relation. With debug(...) it's AND, of course.
Jul 25 2016