[Lazarus] clarification / Re: constant-highlight ? [Re: quick opinion poll / pascal highlighting "case"]
Jürgen Hestermann
juergen.hestermann at gmx.de
Tue May 25 10:36:30 CEST 2010
> This was already and always the case. any identifier, char, number
> is/was highlighted the same never mind if it is in a case label, an
> assignment, an expression .....
Yes, and I think it should not be changed.
> The question was, if a case label (any case-label, never mind it being a
> number, char, string, ident) should have any additional highlights.
> So case labels will stand out from other source?
I don't think so.
> The idea is that they are kind of a "section header" introducing a block
> of code, that is bound to a condition.
Yes, but that's better done with indentation. I always use a formatting like this:
case x of
1,2,3:
begin
... do something
end;
4,5,6:
begin
... do something
end;
7,8,9:
begin
... do something
end;
else
... do something
end; // of case
> In other conditions, you have the "if then" being bold, and the actual
> expression local to the highlighted conditon marker (if then)
> In case of a "case" the label can be far away from the highlight of the
> "case of" => it does not stand out, and can be overlooked.
Formatting helps here more I think. The same applies to "IF ... THEN ... ELSE". The ELSE part can be far away from the IF too.
> - in small case blocks, it is easily seen by the indentation rules (if
> they are there, lets hope for it)
> - in big case blocks, there may be many levels of indent outside, and
> inside the case. It is near impossible to tell if anything is exactly on
> the case-level of indent (especially if the case itself is scrolled of
> the visible screen).
I always follow a strict indentation rule (each block is indented by 3 characters, matching BEGINs and ENDs are either on the same line or are aligned in the same column, all commands of a block start on the same column as their enclosing BEGIN END, etc.). I don't see how this can be replaced by coloring. If you have nested case statements you will still not know to which of the case statements a constant belongs to unless you have a stict intendation rule.
More information about the Lazarus
mailing list