MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica commenting of code using (* *) can't be nested well.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84925] Re: Mathematica commenting of code using (* *) can't be nested well.
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Sun, 20 Jan 2008 03:31:15 -0500 (EST)
  • References: <fmsljm$knj$1@smc.vnet.net> <4791F3F5.9040200@gmail.com>

"Szabolcs Horvát" <szhorvat at gmail.com> wrote in message 
news:4791F3F5.9040200 at gmail.com...
> Nasser Abbasi wrote:
>> Mathematica 6.0.1
>>
>> I do not understand why the following can't be taken as a valid comment
>>
>> (*  comment here   (*  more comments  *)
>>
>> It seems to me that once the first (* is seen by the parser then it 
>> should take everything in front of it, all the way until it sees the 
>> closing *) as one comment.
>>
>> But in the above it does not. The (* in the middle breaks this, which 
>> does not make too much sense to me. What do you think?
>

> I think that it makes a lot of sense, because Mathematica has only one 
> syntax for commenting.  Compare it with the C language where if there are 
> any comments inserted into a function, like this,

But your example below is NOT the same as my example.

>
> void fun() {
>   statement1;
>   statement2; /* comment */
>   statement3;
> }
>
> , then the whole function cannot be commented out:
>
> /*
> void fun() {
>   statement1;
>   statement2; /* comment */  <-- comment is broken here
>   statement3;
> }
> */
>

The above is not what I said. Here is the C code equivelant to what I showed 
in Mathematica, and it works:

$ cat t.c
main(){

     /*                  /*  */

}

$ gcc -c t.c


>
> Fortunately Mathematica (at least the latest version of it) allows the 
> nesting of comments, so this is not a problem.

Again, I am NOT talking about nesting of comments.

>
> -- 
> Szabolcs
>

Nasser 



  • Prev by Date: Re: Tracing a Cycloid
  • Next by Date: cleaning up imported data
  • Previous by thread: Re: Mathematica commenting of code using (* *) can't be nested
  • Next by thread: Re: Mathematica commenting of code using (* *) can't be nested well.