Alastair,

 

The point of my examples was to illustrate that you can put a comment most
anywhere, IF that comment is created using the curly braces.  The
double-dash, on the other hand, gets interpreted slightly differently.  It
looks to me as if once R:BASE reads the double-dash it takes the rest of the
line as the comment, whereas the curly braces encapsulate the comment.  So
anything on a line following the double-dash is ignored, and therefore the
EOL has been encountered.  But since the curly braces encapsulate the
comment, it can in fact be embedded in the middle of a command.

 

Not that I recommend the practice, unless you want to drive another
programmer crazy or something .

 

Personally, I like the comment-on-its-own-line approach.  The comment is
clear, the code is clear.  But I've seen code that puts a double-dash
comment following, say, an ENDIF to indicate which IF condition it is
ending.  When the entire IF / ENDIF block cannot be displayed on the screen
at once, this technique can be useful.

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

From: [email protected] [mailto:[email protected]] On Behalf Of Alastair
Burr
Sent: Thursday, June 04, 2009 3:38 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Double Hyphen Comments: good practice

 

Thanks Buddy & Emmitt.

 

To make a comment really stand out and, in particular, to divide a command
file into sections I used something like this:

 

--
---------------------------------------------------------------------------

-- Pre-run set-up:

--
---------------------------------------------------------------------------

 

where the length of the first and third lines is 78 characters.

 

For SET VAR, for example, I put the comment on the same line and line them
up to make a "column" on the right-hand edge.

 

Now, Emmitt, it must take a very special brain <g> to come up with your
example so I copied and pasted both into a file. RBEdit nicely highlights
what it sees as comments. I'm not sure that it would ever have occurred to
me to put any comment in the middle of any command but, I suppose, that is,
in effect, what I was asking about: does any command need a CR/LF - in
another way.

 

Regards,

Alastair.

 

 

----- Original Message ----- 

From: Walker, Buddy 

To: RBASE-L Mailing List 

Sent: Thursday, June 04, 2009 12:25 AM

Subject: [RBASE-L] - RE: Double Hyphen Comments: good practice

 

Alastair

  I do the same as you keep comments on their own line.  I actually like the
comment to be left justified. This way it is easier to pick up. 

 

Buddy

 

----- Original Message ----- 

From: Emmitt Dove <mailto:[email protected]>  

To: RBASE-L Mailing List <mailto:[email protected]>  

Sent: Thursday, June 04, 2009 1:31 AM

Subject: [RBASE-L] - RE: Double Hyphen Comments: good practice

 

There appear to be some limits.  Try this code:

 

  IF {this is a test} .#PI <> 0 THEN

    WRITE -- really testy! 'It Works!'

  ENDIF

  RETURN

 

You'll get a syntax error on the WRITE statement, which, of course, means
that the IF worked.

 

Now try this:

 

  IF {this is a test} .#PI <> 0 THEN

    WRITE {really testy!} 'It Works!'

  ENDIF

  RETURN

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

From: [email protected] [mailto:[email protected]] On Behalf Of Alastair
Burr
Sent: Wednesday, June 03, 2009 6:47 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Double Hyphen Comments: good practice

 

I've not come across any problem and the help makes no observations other
than leaving at least one space if placed on the same line as a command...

 

but:

 

Are there any situations  where it is preferable not to place a comment on
the same line as the command?

 

I only ask because, generally, I tend to avoid doing so with, for example
IF, SWITCH, WHILE. Am I being over-cautious?

 

 

Regards,

Alastair

 

----------------------------

Alastair Burr

St. Albans, UK.

[email protected]

-----------------------------

 

  _____  


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.51/2151 - Release Date: 06/02/09
17:53:00

Reply via email to