www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - version.html doc. bug

reply Dave <Dave_member pathlink.com> writes:
At http://digitalmars.com/d/version.html

This example is wrong:

class Foo
{
int a, b;
debug:
int flag;
}

It should be:
class Foo
{
int a, b;
debug int flag;
}

- Dave
Sep 09 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Dave wrote:
 At http://digitalmars.com/d/version.html
 
 This example is wrong:
 
 class Foo
 {
 int a, b;
 debug:
 int flag;
 }
 
 It should be:
 class Foo
 {
 int a, b;
 debug int flag;
 }
 

Forgive me, what is wrong with the example as it stands? Its working valid D and illustrates the 'debug' attr-stmt, albeit in a cheesy NoOp sort of way. -- Chris Sauls
Sep 10 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Sat, 10 Sep 2005 04:26:02 -0500, Chris Sauls wrote:

 Dave wrote:
 At http://digitalmars.com/d/version.html
 
 This example is wrong:
 
 class Foo
 {
 int a, b;
 debug:
 int flag;
 }
 
 It should be:
 class Foo
 {
 int a, b;
 debug int flag;
 }
 

Forgive me, what is wrong with the example as it stands? Its working valid D and illustrates the 'debug' attr-stmt, albeit in a cheesy NoOp sort of way.

class Foo { debug: int flag1; this() { debug: // found ':' instead of statement int flag2; } } -- Derek Parnell Melbourne, Australia 10/09/2005 9:02:14 PM
Sep 10 2005
parent reply Dave <Dave_member pathlink.com> writes:
In article <1j8s5arhhzgdn.urwa8lhaj35j$.dlg 40tude.net>, Derek Parnell says...
On Sat, 10 Sep 2005 04:26:02 -0500, Chris Sauls wrote:

 Dave wrote:
 At http://digitalmars.com/d/version.html
 
 This example is wrong:
 
 class Foo
 {
 int a, b;
 debug:
 int flag;
 }
 
 It should be:
 class Foo
 {
 int a, b;
 debug int flag;
 }
 

Forgive me, what is wrong with the example as it stands? Its working valid D and illustrates the 'debug' attr-stmt, albeit in a cheesy NoOp sort of way.

class Foo { debug: int flag1; this() { debug: // found ':' instead of statement int flag2; } }

Yes, and: - The BNF doesn't specify the ':' form. - The ':' form is not consistent with how version(id), debug(id) and the other compiler conditionals work. So, I think the example is wrong, which is fine with me (rather than adding more fluff to the language and being inconsistent). - Dave
Sep 10 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Dave wrote:
 In article <1j8s5arhhzgdn.urwa8lhaj35j$.dlg 40tude.net>, Derek Parnell says...
 
On Sat, 10 Sep 2005 04:26:02 -0500, Chris Sauls wrote:


Dave wrote:

At http://digitalmars.com/d/version.html

This example is wrong:

class Foo
{
int a, b;
debug:
int flag;
}

It should be:
class Foo
{
int a, b;
debug int flag;
}

Forgive me, what is wrong with the example as it stands? Its working valid D and illustrates the 'debug' attr-stmt, albeit in a cheesy NoOp sort of way.

However, this fails ... class Foo { debug: int flag1; this() { debug: // found ':' instead of statement int flag2; } }

Yes, and: - The BNF doesn't specify the ':' form. - The ':' form is not consistent with how version(id), debug(id) and the other compiler conditionals work. So, I think the example is wrong, which is fine with me (rather than adding more fluff to the language and being inconsistent). - Dave

It isn't inconsistant. All the attributes and attr-statements (such as 'version' and 'debug') work with the ':' form, and here's the kicker, /outside of function bodies/. Personally I think even that is a needless restriction, since the ':' form means to perpetuate/propogate a given attribute until either the current scope ends or a contradictory attribute is reached (or in the case of attr-statements, the corresponding 'else' clause is reached). For documentation, check out: http://digitalmars.com/d/attribute.html -- Chris Sauls
Sep 10 2005
parent Dave <Dave_member pathlink.com> writes:
In article <dfvbnf$628$1 digitaldaemon.com>, Chris Sauls says...
Dave wrote:
 In article <1j8s5arhhzgdn.urwa8lhaj35j$.dlg 40tude.net>, Derek Parnell says...
 
On Sat, 10 Sep 2005 04:26:02 -0500, Chris Sauls wrote:


Dave wrote:

At http://digitalmars.com/d/version.html

This example is wrong:

class Foo
{
int a, b;
debug:
int flag;
}

It should be:
class Foo
{
int a, b;
debug int flag;
}

Forgive me, what is wrong with the example as it stands? Its working valid D and illustrates the 'debug' attr-stmt, albeit in a cheesy NoOp sort of way.

However, this fails ... class Foo { debug: int flag1; this() { debug: // found ':' instead of statement int flag2; } }

Yes, and: - The BNF doesn't specify the ':' form. - The ':' form is not consistent with how version(id), debug(id) and the other compiler conditionals work. So, I think the example is wrong, which is fine with me (rather than adding more fluff to the language and being inconsistent). - Dave

It isn't inconsistant. All the attributes and attr-statements (such as 'version' and 'debug') work with the ':' form, and here's the kicker, /outside of function bodies/. Personally I think even that is a needless restriction, since the ':' form means to perpetuate/propogate a given attribute until either the current scope ends or a contradictory attribute is reached (or in the case of attr-statements, the corresponding 'else' clause is reached). For documentation, check out: http://digitalmars.com/d/attribute.html -- Chris Sauls

It doesn't work (v0.131) with either version or debug and the BNF specific to debug and version doesn't specify it so either that example is wrong or the docs. are inconsistent and the compiler is wrong. - Dave
Sep 10 2005