TCL-URL! 1998-05-25

by Jean-Claude Wippler - DejaNews: [1] 

This week's features: a link, a FAQ, and an extension: 

 The "Welcome to comp.lang.tcl" message by Andreas Kupries 
http://www.westend.com/~kupries/c.l.t.welcome.html

 Bug with comments and braces? - Dr Richard A. O'Keefe's answer (see 
DN355119991) 

'===============================

"Dr Richard A. O'Keefe"  - 21 May 1998 - comp.lang.tcl 
 Colin Perkins wrote:
 > It's much as if there's a proc defined for comments, which ignores its
 > arguments, ie: in psuedo tcl...
 >         proc # {args} {
 >         }
 > Hence comments can go anywhere a command can go.
 >
 > No?

 No.  A comment can start with # #foo #, #: or anything like that.
 There is no problem _at the time that the comment is _.

 The nature of the problem is that curly braces are just quotation marks;
 STUFF QUOTED WITH BRACES NEED NOT BE CODE.

 If, for example, I did
    set x {#foo}
 I would be very upset if the closing curly brace were ignored.

 If you want an unbalanced curly brace in a comment, the method is the
 same as putting unbalanced curly braces in any other kind of string.
 Use \

     set x {#foo\}}

 will do the trick.

 By the way, it's not just comments.  Indeed, it has nothing to do with
 comments as such.  Consider trying to get a curly brace in a string in
 code.
 At top level, what could be easier than

     set x "}"

 But if you do

     proc xb {} {
         global x
         set x "}"
     }

 you'll be told 'extra characters after close-brace'.
 The same solution applies:

     proc xb {} {
         global x
         set x "\}"
     }

 The thing is not "beware of comments" but "beware of unmatched }".

'===============================

 TclOCX is "Tcl inside an ActiveX control" by Andrew Friedl 
http://home.earthlink.net/~affriedl/TclOCX/