Re: Re: Mathematica commenting of code using (* *) can't
- To: mathgroup at smc.vnet.net
- Subject: [mg84988] Re: [mg84951] Re: Mathematica commenting of code using (* *) can't
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Tue, 22 Jan 2008 01:51:27 -0500 (EST)
- References: <fmsljm$knj$1@smc.vnet.net> <200801210906.EAA09435@smc.vnet.net>
Martin Johansson wrote: > 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 it would be useful (at least for me, the way I work when coding > and debugging) if it worked the way you expected(?). I often have a line > like > > something = somethingElse; (* with a comment *) > > that I want to "comment out" while testing my code by merely adding (* > at the beginning of the line. But maybe there are issues with this type > of parsing that more competent programmers can point out. > > //Martin Here is an issue. Quite often one (me, for instance) will want to comment out a larger block of code, one that might contain comments. In order to do this I want to just enclose it with the usual comment bracketing pair. I do not want to concern myself with whether it has nested comments, let alone whether or how a nested comment might cause the entire comment block to terminate in a way that is, for my perposes, premature. In this situation I am quite happy to always type in the closing right side of the comment delimiter, even in cases where the block is but one line and already might have, at its right end, a comment delimiter from a nested comment. I have seen the notion of a "one terminates all" right delimiter once in my life. That was the right bracket terminating arbitrarily many left parens in Lisp. I saw this a very long time ago, and I've not used Lisp since then (though not because of how it treated right brackets). I do not know if that handling was common in Lisp, let alone in Common Lisp. And at least it required a separate delimiter of bracket instead of paren. I have to say that this idea, if extended to other common coding constructs (blocks, if statements, etc.) would seem quite weird. I'm thus finding it a bit difficult to understand why a special case should be made for handling of comment delimiters. For the record: I think the notion of having a single right hand comment delimiter terminate all open left delimiters is absolutely idiotic. I mention this, using provocative language, in the hope that some of the people who like this syntax will be motivated to explain why it might be really preferable to the balanced delimiter handling. Daniel Lichtblau Wolfram Research
- References:
- Re: Mathematica commenting of code using (* *) can't be nested
- From: Martin Johansson <martin.n.johansson_LookMa_NoSpam_@ericsson.com>
- Re: Mathematica commenting of code using (* *) can't be nested