This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Ucomment

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Slaktarn
Halfop
Posts: 44
Joined: Wed May 02, 2007 1:48 am

Ucomment

Post by Slaktarn »

Hay everyone then it was time again....

1: The only way i have found to ucomment in TCL is #

2: But i try to find a way to do it like C++ or PHP

I need to do


Code: Select all

# My comment
Code
But i wuld like to do something like

Code: Select all

/* MyComment */ Code
/Slaktarn
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

That is true, the only way to create a comment in tcl is by using the hash-character (#). Unless you feel like re-writing your tcl-library, don't expect to change this behaviour...
NML_375
S
Slaktarn
Halfop
Posts: 44
Joined: Wed May 02, 2007 1:48 am

Post by Slaktarn »

nml375 wrote:That is true, the only way to create a comment in tcl is by using the hash-character (#). Unless you feel like re-writing your tcl-library, don't expect to change this behaviour...
Don´t you think its bad that its only way to do it

You can´t make notes on same row before a code just after and onn a own row its insane. Considering there its a old language and shuld be away to do it. My opinion relly strange

/Slaktarn
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Slaktarn wrote:
nml375 wrote:That is true, the only way to create a comment in tcl is by using the hash-character (#). Unless you feel like re-writing your tcl-library, don't expect to change this behaviour...
Don´t you think its bad that its only way to do it

You can´t make notes on same row before a code just after and onn a own row its insane. Considering there its a old language and shuld be away to do it. My opinion relly strange

/Slaktarn

Code: Select all

set b "huh" ; # comment
set c "exactly" ; # another comment
Putting comments before code is meant for compiled languages, tcl is interpreted. Therefore comments need to go "; #after" code, or on a line of their own. This simplifies the constructs the parser needs to recognize to see the item as a comment.
S
Slaktarn
Halfop
Posts: 44
Joined: Wed May 02, 2007 1:48 am

Post by Slaktarn »

speechles wrote:

Code: Select all

set b "huh" ; # comment
set c "exactly" ; # another comment
Putting comments before code is meant for compiled languages, tcl is interpreted. Therefore comments need to go "; #after" code, or on a line of their own. This simplifies the constructs the parser needs to recognize to see the item as a comment.
Hehe so the only way to do it is the way you show... Hoever im not so good in TCL you seems to be relly good.

; is to tells that its the end of code/line right so its batter to have

Code: Select all

1: set a [lindex 1] ; # Comment
2: set b [lindex 1] # Comment
Then the exampel 1 is batter then exampel 2 i guss

/ Slaktarn
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Slaktarn wrote:
nml375 wrote:That is true, the only way to create a comment in tcl is by using the hash-character (#). Unless you feel like re-writing your tcl-library, don't expect to change this behaviour...
Don´t you think its bad that its only way to do it

You can´t make notes on same row before a code just after and onn a own row its insane. Considering there its a old language and shuld be away to do it. My opinion relly strange

/Slaktarn
Nope, it's the way tcl works, and it works well enough for me...
And frankly, C is far older than tcl...

Honestly, I can't even see the problem with not being able to put comments in front of a line of code.. To me, that'd just make the whole piece of code harder to read, but then again, that's just my humble opinion..

I suppose you've got an issue with the way you comment code in bash-scripts too?
NML_375
Post Reply