www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - the "debug" feature

reply dennis luehring <dl.soluz gmx.net> writes:
it would be nice to have a feature to declare complete 
modules/fucntions/classes/methods as debug

for example (as an idea):
   debug void test(int x){ ... } // like an complete debug{ ... } span
   debug class test1 {...}

ciao dennis
Jun 30 2004
next sibling parent reply pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cbuj0e$bgk$1 digitaldaemon.com>, dennis luehring says...
it would be nice to have a feature to declare complete 
modules/fucntions/classes/methods as debug

for example (as an idea):
   debug void test(int x){ ... } // like an complete debug{ ... } span
   debug class test1 {...}

ciao dennis
Most statements in D can also be used to define a block (using { and } ) Try this: Compile with "-debug" and you're in business. - Pragma
Jun 30 2004
parent dennis luehring <dl.soluz gmx.net> writes:
pragma <EricAnderton at yahoo dot com> wrote:
 In article <cbuj0e$bgk$1 digitaldaemon.com>, dennis luehring says...
 
it would be nice to have a feature to declare complete 
modules/fucntions/classes/methods as debug

for example (as an idea):
  debug void test(int x){ ... } // like an complete debug{ ... } span
  debug class test1 {...}

ciao dennis
 Most statements in D can also be used to define a block (using { and } ) 
i know this but wouldn't it be nice to reduce this block spanning with just one keyword at the right place? just to reduce the block count or an feature to use this not a class defition time for example maybe i want to do this: debug ClassTest test_as_debug; ClassTest test_as_releas; in this scenario i want only the object "test_as_debug" with debug information
Jun 30 2004
prev sibling parent reply Sam McCall <tunah.d tunah.net> writes:
dennis luehring wrote:

 it would be nice to have a feature to declare complete 
 modules/fucntions/classes/methods as debug
 
 for example (as an idea):
   debug void test(int x){ ... } // like an complete debug{ ... } span
   debug class test1 {...}
 
 ciao dennis
 
 
Have you tried it? It should work fine. http://www.digitalmars.com/d/attribute.html D's attributes are brilliant. Sam
Jun 30 2004
parent reply dennis luehring <dl.soluz gmx.net> writes:
Sam McCall wrote:
 dennis luehring wrote:
 
 it would be nice to have a feature to declare complete 
 modules/fucntions/classes/methods as debug

 for example (as an idea):
   debug void test(int x){ ... } // like an complete debug{ ... } span
   debug class test1 {...}

 ciao dennis
 Have you tried it? It should work fine.
 http://www.digitalmars.com/d/attribute.html
 D's attributes are brilliant.
looks like what i want
Jun 30 2004
parent reply dennis luehring <dl.soluz gmx.net> writes:
 Have you tried it? It should work fine.
 http://www.digitalmars.com/d/attribute.html
 D's attributes are brilliant.
looks like what i want
in some of my projects codegernators were used to "publish" methods through an command-pattern based plugin system... can i use this feature for code generators: (in need a marker for my parser to find "to published functions") for example: (pseudo code) class Test { private: funct1 funct2 public: funct3 for_the_generator: funct4 funct5 } ciao dennis
Jun 30 2004
next sibling parent reply pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cbunvc$ipn$1 digitaldaemon.com>, dennis luehring says...
in some of my projects codegernators were used to "publish" methods 
through an command-pattern based plugin system...

can i use this feature for code generators:
(in need a marker for my parser to find "to published functions")

for example:

(pseudo code)
class Test
{
   private:
     funct1
     funct2
   public:
     funct3
   for_the_generator:
     funct4
     funct5
}

ciao dennis
Sometimes simple is best. I like what you're trying here, but I think D will reject this since 'for_the_generator' is not a valid attribute. I know that Visual Studio has used comments as markers for auto-generated code for the longest time: Or if you need to tag definitions one at a time: - Pragma
Jun 30 2004
parent reply dennis luehring <dl.soluz gmx.net> writes:
 ...I like what you're trying here, but I think D will
 reject this since 'for_the_generator' is not a valid attribute.
i like my ideas too
 I know that Visual Studio has used comments as markers for auto-generated code
 for the longest time:



 Or if you need to tag definitions one at a time:

i think that hiding such control-information in comments or special names is a dirty other-language-like solution walter: what about defineable attributes for D?
Jun 30 2004
parent reply pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cbuv5u$t6j$1 digitaldaemon.com>, dennis luehring says...
i think that hiding such control-information in comments or special 
names is a dirty other-language-like solution
I agree.. but hey, it'll work for now right?
 walter: what about defineable attributes for D?
I wouldn't mind a feature like that one bit, even if it does sound a bit like - Pragma
Jun 30 2004
parent reply dennis luehring <dl.soluz gmx.net> writes:
pragma <EricAnderton at yahoo dot com> wrote:
 In article <cbuv5u$t6j$1 digitaldaemon.com>, dennis luehring says...
i think that hiding such control-information in comments or special 
names is a dirty other-language-like solution
I agree.. but hey, it'll work for now right?
it must not work "now" - cause i've got (currently) no D based projects - but in the future it would be nice to have such features
 walter: what about defineable attributes for D?
I wouldn't mind a feature like that one bit, even if it does sound a bit like
Jul 01 2004
parent pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cc0d87$13g$1 digitaldaemon.com>, dennis luehring says...
 walter: what about defineable attributes for D?
I wouldn't mind a feature like that one bit, even if it does sound a bit like
the language. The idea is that you can assign attributes to classes, instances and such to give the compiler hints on what to do with a given item. *Custom* attributes are only really useful via reflection, and allows you to do some code and can be used within the same project sourcecode as where it is used. This gives you a very powerful way to make class metadata far more meaningful than just raw class info. For example, I once created a class that would initalize static members on classes, in an arbitrary assembly, from data in an XML file. This utility would look for "[StaticInit]" attributes tagged to static struct and class members and set their values based on their name and hosting class. This was accomplished through 100% reflection, including dynamically loading the assemblies into the runtime as referenced in the config file. Similar techniques can be applied to *intellegently* implement transparent serialization, automatic proxy creation for remoting, etc etc. There may be reasons why you wouldn't want to persist every member of a class or to do special things with making certain methods available over the wire. A facility like this makes it all possible. I for one would love to see a similar, or more advanced, set of features in the next full release of D (version 2?). :) Here's a pretty good article on the topic: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkattributestutorial.asp - Pragma
Jul 01 2004
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
dennis luehring wrote:
 Have you tried it? It should work fine.
 http://www.digitalmars.com/d/attribute.html
 D's attributes are brilliant.
looks like what i want
in some of my projects codegernators were used to "publish" methods through an command-pattern based plugin system... can i use this feature for code generators: (in need a marker for my parser to find "to published functions") for example: (pseudo code) class Test { private: funct1 funct2 public: funct3 for_the_generator: funct4 funct5 } ciao dennis
Have you considered using version (http://www.digitalmars.com/d/version.html). I'm not sure I understand the purpose of your proposed User Defineable Attributes, but I think you can effectively emulate them by making using of D's existing versioning features. It's a little more wordy than your proposal, but I think it'll work. Here's an example: version(myCodeGeneration) version = published; class Plugin { public: void Function1(...) int Function2(...) version(published) { int Function3(...) int m_nMaxCount } private: } The code in the version block is only compiled if the myCodeGeneration or published version is set, such as: dmd test.d version=myCodeGeneration -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Jul 02 2004