> > ... use the underscore, although a bit messy looking:
> >
> >   function SubstringData(const Offset, Count_: Integer): WideString; 
> > virtual;
> > ...
>
> Thanks. Matches to the habit of the guy, who has written
> the Delphi code, that I am working on. He usually begins
> each private class item name with an underscore. Meanwhile
> is habit seems appropriate to me. Now I will probably
> change my habit, concerning parameter names as well, by
> ending with >an underscore, as you proposed.

I dunno it is a religious thing, read the other messages too :)

I guess too many underscores in the code I find messy so I've fallen for the 'A'
prefix now. I use underscores only where there is really a need, and have found 
that
too many of them in code causes messiness and hard to read code. Either 
solution is
okay, but since there is lots of existing Pascal code out there that uses the A
prefix, it's probably best to use it. I'm not stubborn and am willing to change 
for
the better.

I do prefer underscores in very special special cases, such as when you have a 
very
similar function but it does something special in addition to the other 
function:

Parse   (input: string);
Parse_SF(input: string);

SF stands for secure and fast implementation, whereas

ParseFastAndSecureImplementation() is way too long, and you cannot tell whether 
it is
 Parse Fast, the secure implementation or
 Parse the Fast, Secure, implementation  or
 Parse, and please do it securely and fast

Also
 ParseFastAndSecureImplementation() looks extremely different than
 Parse() whereas
 Parse_SF looks extremely similar to
 Parse() so you know that Parse_SF() and Parse() are two similar functions, 
with one
just being special.

So the underscore helps suffix and separate function and keep the code logical
without being extremely verbose. This is the sacrifice I've made for making
underscores useful in some areas - some prefer to skip underscores altogether 
for
religious reasons, I prefer to include underscores in code when they have some
extreme advantage.

And the brackets? Yes I know it is a sin in Pascal to use Procedure() and only 
Java
programmers do that, I was just using the brackets in this text so that the 
text was
easier to read, i.e. distinguish Pascal procedure from English text.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to