Sometime ago on the comp.lang.c, I saw a teacher's post asking why C
compilers produce so many error messages as soon as a closing bracket is
missing. The response was simply because the compiler can't tell where a
bracket is missing.... a few weeks have past, I requested a feature for the
delphi ide/editor "automatic identation of code in begin/end statements etc"
and today when I woke up I suddenly released a very simple solution for this
problem by simply using something called "contex". Which is something
autistic people have great trouble recognizing and since many autistic
people work in the tech industry here is a short example to explain how
"context" can solve the problem.
Let's look at two identation styles.
The first one is my preferred style which is commonly used in pascal/delphi.
Some people in the delphi community recommended to use 2 spaces for identing
a few years ago. I do hope that they by now realize that using tabs is much
more efficient and works faster. I myself use 4 spaces for each tab
character. (Which is also used further down in this example (tabs converted
to spaces) )
Anyway let's get back to the styles.
The first style: pascal/delphi style/my style (the smart style):
begin
<identation>code
<identation>if a<b then
<identation>begin
<identation><identation>code
<identation><identation>code
<identation>end;
end;
The second style: perverted C/Java style (the dumb style):
{
<identation>code
<identation>if a<b {
<identation><identation>code
<identation><identation>code
<identation>}
}
Let's compare both styles.
The second/dumb style is much more hard to figure out where a missing
bracket is located.
Here is an example of the "dumb" style in action:
Can you tell where the missing closing bracket is ?
{
xxxxxxxxxxxxx{
xxxxxxxxxxxxxxxxxxxx{
xxxxxxxx}
xxxxxxxxxxxxxxxxxxxxxxxxx{
xxxxxxxx}xxxxxx{
xxxxxxxx}
xxxxxxxxxxxxxxxxxx{
xxxxxxxxxxxxxxxxxxxxxxxxx{
xxxxxxxx}
xxxx}
}
If you did manage to find it it must have costs you lot's of time to figure
it out

Since to figure it out a complex algorithm is necessary to find
the missing bracket.
Now I present to you the smart style:
{
xxxxxxxxxxxx
xxxx{
xxxxxxxxxxxxxxxxxxx
xxxxxxxx{
xxxxxxxx}
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxx{
xxxxxxxx}xxxxx
xxxxxxxx{
xxxxxxxx}
xxxxxxxxxxxxxxxxx
xxxx{
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxx{
xxxxxxxx}
xxxx}
}
You didn't spot it the first time ? Take a closer look !
Yeah now you see it don't you
The 9th bracket is missing in both examples.
However it did cost you much less time to figure out where the missing
bracket is in the smart style.
Why can't a compiler do this ? Why does a compiler have to produce so many
error messages when a closing bracket is missing ? Why isn't the compiler
smart like us ? (well at least some of us)
The answer is: in the context. We are aware of the context.
The context is the identation. The identation indicates where a statement
block begins and ends.