I was intrigued by this
https://wiki.lazarus.freepascal.org/Why_Pascal_is_Not_My_Favorite_Programming_Languagebut most of it are prove obsolete, great!
and yea, well kido Child(Java) GrandChild(C#)
about ha file and haha file, you prove your father(C) and uncle(C++) ....
you hate it right? hahaha
we use only one, right, wonder have you lost the ha haha file ?
but why you two have so much detail in front,
dont you know detail can be the devil?
we dont need to scroll, we just look at interface.
yea, but, but, there is tool call code folding
dont you know, we can still do programming with a pencil and paper?
but you have to scroll in line full of comment,
just to find a method? ouch!
we do less comment, and try to self-documenting code
and kido(Java), your child(C#) learn from us,
you say dont need unsigned?
see your cousin(Java Script) and your friend Kotlin and Lua, what happen?
and this from your uncle
http://cshandley.co.uk/CppConsideredHarmful.htmlhttps://whydoesitsuck.com/cpp-sucks-for-a-reason/we learn from him also.
Now for
https://www.kernel.org/doc/html/v4.10/process/coding-style.html1) Indentation
Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!) characters deep,
and that is akin to trying to define the value of PI to be 3.
Rationale:
The whole idea behind indentation is
to clearly define where a block of control starts and ends.
Especially when you’ve been looking at your screen for 20 straight hours,
you’ll find it a lot easier to see how the indentation works
if you have large indentations.
Now, some people will claim that having 8-character indentations
makes the code move too far to the right,
and makes it hard to read on a 80-character terminal screen.
The answer to that is that if you need more than 3 levels of indentation,
you’re screwed anyway, and should fix your program.
In short, 8-char indents make things easier to read,
and have the added benefit of warning you when you’re nesting
your functions too deep. Heed that warning.
if I am not mistaken, easier to read for 20 straight hours ...
well I m working 9 to 5, so that means 8 hours, but sometimes late 2 hours
in current average equal to 10 hours
so my tab 10/20*8 equal 4 characters,
ah I wonder when I was newbie, just read less than 5 hours,
so the tab is 2, and still newbie ...
for PI to be 3, I think He should meet aunt ADA, she strict to 3 character,
or may be she is been influence by uncle Tesla number.
the number should be 3 and 6 -> 234 6 8, make balance in between
just to prove, it may be true or false:
https://wiki.freepascal.org/Coding_styleuse of hanging indent, to skim quickly, without distractions,
http://faculty.georgetown.edu/spendelh/handouts/hanging-indent.htmprogram identation;
{$mode objfpc}
{$h+}
type
Timestamp = record
DateTime :Int64;
TimeTick :UInt64;
end;
var
ts :Timestamp;
i :Integer;
// block statement
begin
WriteLn;
WriteLn;
WriteLn;
-- with end
with ts do
begin
WriteLn;
end;
-- try except end
try
WriteLn;
except
WriteLn;
end;
-- or try end finally end
try
begin
WriteLn;
end;
finally
WriteLn;
end;
while true do
begin
WriteLn;
end;
repeat
WriteLn;
until false;
for i:=1 to 10 do
begin
WriteLn;
end;
if true then
begin
WriteLn;
end
else
begin
WriteLn;
end;
// for simple if else
if true then
WriteLn
else
WriteLn;
// or
if false
then WriteLn
else WriteLn;
case i of
1:
begin
WriteLn;
end;
2:
begin
WriteLn;
end;
3:
begin
WriteLn;
end;
end;
end.
as we can see in the program,
statement WriteLn is consistently align by 6 characters
and keyword are align by 3 characters
When I read more than 10 hours, is when to find bug,
thats it! we are in hurry, its time for speed reading.
https://en.wikipedia.org/wiki/Speed_readingby skimming, scanning, jumping, skipping
today debugger so generous that we can directly spot the line number which error
so we can directly open our file.
when we do debugging, our intent is more toward identifier,
rather than keyword, keyword can be skip,
or for our Hero member it could be by sixth sense.
so by dimming keyword color, we can make more intent of Identifier.
by making 3 tab characters with a appropiate style,
make look indentation balance and not too far 6 vs 8.
Is it true aunt(ADA) ?
4) Naming
C is a Spartan language, and so should your naming be.
Unlike Modula-2 and Pascal programmers,
C programmers do not use cute names like ThisVariableIsATemporaryCounter.
A C programmer would call that variable tmp, which is much easier to write,
and not the least more difficult to understand.
HOWEVER, while mixed-case names are frowned upon,
descriptive names for global variables are a must.
To call a global function foo is a shooting offense.
We are the real spartan, dont you like our helmet?
https://forum.lazarus.freepascal.org/index.php?topic=34693.0aunt(ADA) use This_Variable_Is_A_Temporary_Counter so clear,
but we and she can do directly and briefly, also. meh
Encoding the type of a function into the name (so-called Hungarian notation)
is brain damaged - the compiler knows the types anyway and can check those,
and it only confuses the programmer.
No wonder MicroSoft makes buggy programs.
https://en.wikipedia.org/wiki/Hungarian_notationsomehow we agree
https://wiki.freepascal.org/DoDontand by the way because your so case sensitive and we are not
can you spell it
string MYString // MYString is supposed to be string
string MyString // MyString is supposed to be string
string myString // myString is supposed to be string
string mystring // mystring is supposed to be string
we hear it all the same? which one?
AString :String; // A string is String
FString :String; // we agree that prefix F is for field name
FString := AString;
myString = MyString; // ? yes it same, but you say not? oh my...
anyway
Dom Tor Etto said 'This is brazil!'
and well ...
uncle Ver
Dom Me say 'This is Free Pascal!'