parsing comments in scripts

Martin Baxter martin at materiaprima.fsnet.co.uk
Mon Dec 13 03:23:55 EST 2004


>On Dec 12, 2004, at 6:22 PM, J. Landman Gay wrote:
>
>> I see the point people are making, but I'd sure miss the current
>> behavior if it changed. The ability to comment out an entire handler
>> by commenting the first line has been in xtalk for 18 years. I have
>> become dependent on it.
>
>As Alex pointed out, it is really only an illusion for Transcript.  It
>doesn't work.
>
>As for Hypertalk, my copy of "Hypercard Script Language Guide: The
>HyperTalk Language" says "Statements always appear in handlers in a
>script.  Any part of a statement following HyperTalk's double-hyphen
>comment character (--) is ignored by HyperCard."  I read this as saying
>that the ability was not intended to be part of HyperCard.
>
>I am curious if others use the technique of commenting out a handler by
>commenting out the first line.  Maybe there is a way to rescue this
>kind of thing in a clean way.
>
>Dar

Yes I do use it occasionally, when I want to quickly disable a handler for
debugging or somesuch purpose. If I want to disable a handler on a more
long term basis I would comment the whole thing out. My habit is that I
wouldn't actually save a stack with handlers commented out this way.

As Jacqueline pointed out, this was a standard practise in Hypercard. And
as you note Dar, in that environment there was really no problem with
"junk" in the sense you mean because anything outside of a handler
declaration was simply ignored, since there was no syntax at all that was
valid outside a handler. On the slower machines of those days it was more
efficient to disable a script by commenting one line than to comment the
whole thing, which might also introduce enough characters to drive the
script beyond the old length limit of 30000 characters.

I do wonder though how likely it is that you would comment :

-- on whatever

either accidentally or with any other purpose than disabling the handler ?

Martin






More information about the use-livecode mailing list