August 21, 2001
Christophe de Dinechin wrote in message <3B7D3295.4886A523@earthlink.net>...
>See where I'm going? Now you have to defer semantics of foo and bar until
the
>first-level semantics of every possibly constant declaration in the file
has
>been processes. That's going to be ugly.


No, it's not bad. The compiler makes multiple passes over the syntax tree to do the semantics. That's how forward references are resolved as well.

>And last, what is considered a constant declaration? Let me build a corner case:
>
>    const int check_stuff = (int) &bar - (int) &foo > 1024;
>
>Now, you have a recursive constant declaration, which impacts the size of
the
>functions, and depends on it. Good luck processing that ;-)


A constant declaration is one that the compiler can figure out at compile time <g>.

>By the way, what if I want to disable a declaration? To remove debugging fields in a struct?


Use the debug attribute.


August 22, 2001
is there any reason why comments should not be able to be nested?  As long as the number of /* match the number of */ I don't see any problem.  ie.

/*
    commented code 1
    /*
        commented code 2
    */
    commented code 3
*/

Why can't this be made to work?  Just increment a comment counter when a /* is recieved and decrement it on a */.  Thanks.

Kent Sandvik wrote:

> "Angus Graham" <agraham_d@agraham.ca> wrote in message news:9lhphi$bts$1@digitaldaemon.com...
>
> > I'm totally naive when it comes to compiler implementation, but I can't imagine how nested comments would complicate things on the implementation side.
>
> I've always had problems with nested comments, the 'if 0' trick works just fine, lack of nested comments would not be a big minus for me when shopping for a good language. --Kent

August 23, 2001
Making it work is easy. The trouble is that C/C++ programmers are so used to them not nesting, it can introduce bugs that are difficult to spot.

Erik Rounds wrote in message <3B83D77C.9ABB335C@aatrix.com>...
>is there any reason why comments should not be able to be nested?  As long
as
>the number of /* match the number of */ I don't see any problem.  ie.
>
>/*
>    commented code 1
>    /*
>        commented code 2
>    */
>    commented code 3
>*/
>
>Why can't this be made to work?  Just increment a comment counter when a /*
is
>recieved and decrement it on a */.  Thanks.
>
>Kent Sandvik wrote:
>
>> "Angus Graham" <agraham_d@agraham.ca> wrote in message news:9lhphi$bts$1@digitaldaemon.com...
>>
>> > I'm totally naive when it comes to compiler implementation, but I can't imagine how nested comments would complicate things on the
implementation
>> > side.
>>
>> I've always had problems with nested comments, the 'if 0' trick works
just
>> fine, lack of nested comments would not be a big minus for me when
shopping
>> for a good language. --Kent
>


August 23, 2001
How about clear indication on the comment, based on the 'clipprep' style:

%a{  ,,............ %b{.............     %b} ................. %a}

Where the comments have 1 char identifier associated with them.

-- Rajiv


Walter <walter@digitalmars.com> wrote in message news:9m2bil$1unn$2@digitaldaemon.com...
> Making it work is easy. The trouble is that C/C++ programmers are so used
to
> them not nesting, it can introduce bugs that are difficult to spot.
>
> Erik Rounds wrote in message <3B83D77C.9ABB335C@aatrix.com>...
> >is there any reason why comments should not be able to be nested?  As
long
> as
> >the number of /* match the number of */ I don't see any problem.  ie.
> >
> >/*
> >    commented code 1
> >    /*
> >        commented code 2
> >    */
> >    commented code 3
> >*/
> >
> >Why can't this be made to work?  Just increment a comment counter when a
/*
> is
> >recieved and decrement it on a */.  Thanks.
> >
> >Kent Sandvik wrote:
> >
> >> "Angus Graham" <agraham_d@agraham.ca> wrote in message news:9lhphi$bts$1@digitaldaemon.com...
> >>
> >> > I'm totally naive when it comes to compiler implementation, but I
can't
> >> > imagine how nested comments would complicate things on the
> implementation
> >> > side.
> >>
> >> I've always had problems with nested comments, the 'if 0' trick works
> just
> >> fine, lack of nested comments would not be a big minus for me when
> shopping
> >> for a good language. --Kent
> >
>
>


August 24, 2001
	Is this true of most C/C++ programmers?  If I get confused about this
it is always because I assume they they do (or should) nest.  I have
never heard anyone complain about a compiler that did nest them.  I know
such compilers exist.  I just never thought this would be a huge problem
for folks to get used to.  I doubt it will be that big of a problem for
me to get used to it if they don't nest, but nesting seems more logical
to me, since you have unique open and close tokens for the comment.

Dan

Walter wrote:
> 
> Making it work is easy. The trouble is that C/C++ programmers are so used to them not nesting, it can introduce bugs that are difficult to spot.
> 
> Erik Rounds wrote in message <3B83D77C.9ABB335C@aatrix.com>...
> >is there any reason why comments should not be able to be nested?  As long
> as
> >the number of /* match the number of */ I don't see any problem.  ie.
> >
> >/*
> >    commented code 1
> >    /*
> >        commented code 2
> >    */
> >    commented code 3
> >*/
> >
> >Why can't this be made to work?  Just increment a comment counter when a /*
> is
> >recieved and decrement it on a */.  Thanks.
[clip]
August 24, 2001

Dan Hursh wrote:
> 
>         Is this true of most C/C++ programmers?  If I get confused about this
> it is always because I assume they they do (or should) nest.  I have
> never heard anyone complain about a compiler that did nest them.  I know
> such compilers exist.  I just never thought this would be a huge problem
> for folks to get used to.  I doubt it will be that big of a problem for
> me to get used to it if they don't nest, but nesting seems more logical
> to me, since you have unique open and close tokens for the comment.

Back in the day, I believe Turbo C allowed a compiler switch to say whether comments nested. Nesting always seemed more logical and useful to me.

Since switching to C++, though, I've never even been tempted to nest comments.

-R
October 29, 2001
Programmers these days should be using a decent code editor, with syntax highlighting, which would show any comment nesting bug right away.  Nobody does "copy con: myprogram.d" anymore.  ;)  Use the tools available to you.

If the D spec says they nest, then D programmers will expect them to nest; otherwise they won't.  What you decide will *be* what they expect.  So decide wisely.  You've broken enough C compatibility already that tossing out a tiny bit more won't kill anyone.  If you ask me, I say to hell with C/C++ compatibility, make the language nice for its own sake.  Otherwise you may as well expect D to do nothing more in the market than possibly influence the next round of ANSI/ISO C++ standards committee because it won't be enough of an improvement to C++ to warrant switching languages.

Sean

> The problem with nested comments is that programmers don't expect them to
be
> nested. BTW, there is nothing in D that prevents the C preprocessor from being run over it if you really miss it (or any other text macro
processor)!



1 2
Next ›   Last »