Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
September 10, 2005 version.html doc. bug | ||||
---|---|---|---|---|
| ||||
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 |
September 10, 2005 Re: version.html doc. bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave | 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
|
September 10, 2005 Re: version.html doc. bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Sauls | 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; } } -- Derek Parnell Melbourne, Australia 10/09/2005 9:02:14 PM |
September 10, 2005 Re: version.html doc. bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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 |
September 10, 2005 Re: version.html doc. bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave | 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 |
September 10, 2005 Re: version.html doc. bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Sauls | 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 |
Copyright © 1999-2021 by the D Language Foundation