Hi Mike,
I guess I was not clear about the C preprocessor continuation convention. What they require is that the continuation character ("\") be immediately followed by the end of line sequence (\r\n etc.). They logically delete the sequence from the input stream. The Rexx convention is that the continuation character is treated as a blank. I think the continuation character ("-" or "," or whatever) optionally followed by true whitespace characters (blanks, tabs) and then followed by the end of line sequence should be considered to be replaced by the blank, but that a comment following the continuation character not be converted to a blank first. I think that allowing comments between the continuation character and the end of line sequence is confusing and error prone, but we agree to disagree on that one. I haven't checked, but I assume the implementation logically converts comments to a blank before checking for a continuation, and I would do it the other way to disallow comments inside the continuation sequence. I don't think the nesting of comments influences it either way - when a continuation sequence is commented out the continuation character is converted to a comment character, and when the outer comment is removed the character is then a continuation character again. Bill Original Message: ----------------- From: Mike Cowlishaw [hidden email] Date: Tue, 31 Jan 2012 19:55:21 -0000 To: [hidden email] Subject: RE: [Ibm-netrexx] Why is the continuation character (theHYPHEN)neededin some situations *at all* ?? > >From a scanner/parser point of view, I would have preferred that the > continuation character take precedence over comments, so that > > a = b /* this is a valid continuation */ - a = b - /* not a > valid continuation */ > > I think that is more confusing than freeing, but it is easy > to understand why it was implemented that way. Comments nest and override all other syntax so it is easy to 'comment out' a section of code without needing a new syntax. > More > troubling is the fact that Rexx and NetRexx use different > continuation characters, but again, understandable. 20/20 hindsight ... > Other languages, like the C preprocessor, require that there > be no whitespace after the continuation character, and I > think that is too limiting. Another version of the language > might adopt the convention that for continued lines, the last > non-whitespace character is the continuation > character. But I suspect that Mike might disagree. Whitespace is not visible, so requiring it does not 'work'. Last non-whitespace character? Alphabetics, too? Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ -------------------------------------------------------------------- mail2web.com - Microsoft® Exchange solutions from a leading provider - http://link.mail2web.com/Business/Exchange _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Hi,
> I guess I was not clear about the C preprocessor continuation > convention. > What they require is that the continuation character ("\") be > immediately followed by the end of line sequence (\r\n etc.). > They logically delete the sequence from the input stream. > > The Rexx convention is that the continuation character is > treated as a blank. I think the continuation character ("-" > or "," or whatever) optionally followed by true whitespace > characters (blanks, tabs) and then followed by the end of > line sequence should be considered to be replaced by the > blank, but that a comment following the continuation > character not be converted to a blank first. > > I think that allowing comments between the continuation > character and the end of line sequence is confusing and error > prone, but we agree to disagree on that one. I haven't > checked, but I assume the implementation logically converts > comments to a blank before checking for a continuation, and I > would do it the other way to disallow comments inside the > continuation sequence. It's partly a matter of taste, but it's very easy to miss a continuation after a comment: if a=some long expression, /* testing for whatever */ and some more stuff then do /* and for something else */ .... end versus (legal now if you want to do it): if a=some long expression /* testing for whatever */, and some more stuff then do /* and for something else */ .... end Also one would have to worry about line comments: if a=some long expression -- testing for whatever, How would one continue the long expression if the continuation character were not permitted to be followed by a comment? It would be quite dangerous for commas in line comments to be treated as continuations. > I don't think the nesting of comments influences it either > way - when a continuation sequence is commented out the > continuation character is converted to a comment character, > and when the outer comment is removed the character is then a > continuation character again. OK, yes, I should have thought a little longer about that one :-). Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |