Page 2 of 2

Posted: Tue Nov 20, 2007 8:25 pm
by Psychophanta
Logical because of knowing the internal working way, then yes, the behaviour is logical.
But not so logical for a programmers point of view, imho.

Posted: Tue Nov 20, 2007 8:39 pm
by freak
Why ?

Inside a Compilerif, everything is ignored. Including macros.
You need no internal knowledge to understand that.

Macros are also not expanded inside comments as well, and nobody would think that
to be illogical either.

Posted: Tue Nov 20, 2007 8:43 pm
by Psychophanta
freak wrote:Inside a Compilerif, everything is ignored. Including macros.
I see now. Sorry, Thanks.

Posted: Tue Nov 20, 2007 9:20 pm
by PB
>> Which sucks to do when the block is more than a screen size long
>
> That would be a lot of comments

Yes. Sometimes I need to disable a procedure, and when the procedure is
several screen lines long (such as SendKeys), then it becomes a hassle to
select it all and then press CTRL+B.

Also, Freak's CompilerIf solution (which I also once posted) works, but none
of the "commented" code appears in the comment color, which isn't good.
It still looks like uncommented code if you scroll through your source.

Posted: Tue Nov 20, 2007 9:39 pm
by Thalius
PB wrote: Yes. Sometimes I need to disable a procedure, and when the procedure is
several screen lines long (such as SendKeys), then it becomes a hassle to
select it all and then press CTRL+B.
I usually disable functions if needed with a Macro:

Code: Select all

Procedure a(b)
  ; do something
  PrintN(Str(b))
EndProcedure

Macro a(b) : EndMacro ; Disable Function a()
Thalius

Posted: Wed Nov 21, 2007 12:21 am
by #NULL
i make use of folding sequences (like with ";{-") quite a lot, so if i want to uncomment a (bigger) sequence, i just unfold it and can mark it easily on 3 lines.

Posted: Wed Nov 21, 2007 12:38 am
by netmaestro
It's a neat trick but the syntax coloring and keyword recognition happen inside the block, making it too irritating to be a real solution. Turning that off for CompilerIf blocks would make a mess, so some actual comment block keywords would be a nice addition. (just noticed that PB made the same observation, so I agree with him)

Posted: Wed Nov 21, 2007 3:30 pm
by Derek
PB wrote:Yes. Sometimes I need to disable a procedure, and when the procedure is
several screen lines long (such as SendKeys), then it becomes a hassle to
select it all and then press CTRL+B.
I just chuck in an extra character in the name of the procedure and put a new empty definition in front of the old one.

Code: Select all

Procedure P1()
..
..
EndProcedure
becomes

Code: Select all

Procedure P1()
EndProcedure

Procedure oP1()
..
..
EndProcedure
Not the most elegant way of doing things but it saves scrolling through screens of code to ctrl+b.