Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: case sensitive


This question is answered.


Permlink Replies: 11 - Last Post: Jan 15, 2018 10:28 AM Last Post By: Quentin Correll
chen zero

Posts: 30
Registered: 5/26/00
case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 11:20 PM
Hello,
As all of us know, Delphi is case-insensitive,
In my opinion, case sensitive will greatly improve code readability if properly use
certainly, if misuse, case sensitive will bring some confusing.

If, are there any tool that can be used to check code case in the pas ?
e.g: an var is defined as FName, if it's refered as fName, give some warning...

It would be perfect if there is a compiler directive can configure Delphi as case sensitive...

Thanks!
Kim Madsen

Posts: 362
Registered: 12/13/99
Re: case sensitive
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 2:15 AM   in response to: chen zero in response to: chen zero
Hi,

For readability purpose, I completely agree, that using case is a must.
But thats not really what case sensitivity in a compiler is designed
for. Rather it allows you to define the semantically same identifier
which is understood in multiple ways, depending on the combination of
upper and lowercase characters.

That is imo not improving readability, nor debugging.

To have a code formatter thingy that were intelligent enough to
automatically reformat identifiers to camelcase with Delphi's typical
syntax (F... for field variables, T... for type definitions, C... for
constants etc), that would be nice, but the compiler should imo
definitely not be case sensitiv.

Its much better to define two different names that clearly semantically
distinguish between the intended use of an identifier in the various use
cases.

best regards
Kim/C4D

On 10/01/2018 08.20, chen zero wrote:
Hello,
As all of us know, Delphi is case-insensitive,
In my opinion, case sensitive will greatly improve code readability if properly use
certainly, if misuse, case sensitive will bring some confusing.

If, are there any tool that can be used to check code case in the pas ?
e.g: an var is defined as FName, if it's refered as fName, give some warning...

It would be perfect if there is a compiler directive can configure Delphi as case sensitive...

Thanks!
chen zero

Posts: 30
Registered: 5/26/00
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 3:11 AM   in response to: Kim Madsen in response to: Kim Madsen
Hi Kim,
Thank you for suggestion!
I understand that "case sensitive" has pros and cons,
mostly, It's personal programming habit, I will get use this more Delphi way :)
Thanks!
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: case sensitive
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 4:41 AM   in response to: chen zero in response to: chen zero
Hi

This is not quite what you asked for, but have you looked at the
Formatter Capitalization options? They may help.

From the IDE, select Tools > Options, then scroll down to Formatter >
Delphi > Capitalization.
You can then select 'As first occurrence' for the type of 'words' you
wish to control.
If I understand you correctly, reformatting the code should then be
close to what you want.

Malcolm
chen zero

Posts: 30
Registered: 5/26/00
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 7:40 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Hi Malcolm,
Thanks for your suggestion!
Actually, I am a programmer more using C/Java than Delphi, maybe I am too much influenced
by those case-sensitive language.
anyway, if I am to use Delphi, I should follow the Delphi coding standard.
Best Regards
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 5:40 AM   in response to: chen zero in response to: chen zero
"chen zero" wrote on Tue, 9 Jan 2018 23:20:48 -0800:

In my opinion, case sensitive will greatly improve code readability if properly use
certainly, if misuse, case sensitive will bring some confusing.

Pascal has always been case-insensitive. I hope nobody gets the idea
to unilaterally change that...

Personally, I find case sensitivity to be on par (actually, worse)
with Python's whitespace-sensitivity. Utterly unhelpful and
potentially frustrating and confusing. I can think of no legitimate
reason to name two variables in the same scope using the same letters
with the only difference being the case of one letter. There is no
way that ever makes any kind of rational sense, so there is no reason
for the language to support it. IMO. :-)

As for source code formatting, that ought to be consistent and there
are tools to help with that, but I can't see any good reason to allow
two variables to have the same name differentiated only by the case of
a letter...

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
chen zero

Posts: 30
Registered: 5/26/00
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 7:52 AM   in response to: Brandon Staggs in response to: Brandon Staggs
Hi Brandon,
Thanks for your advice!
I also do not get used to Python's whitespace casesensitive. however, for those case-sensitive language(java/c), if get familiar with, you will fell that easy in code readability. I hope if Delphi can
write in this way, e.g:
Car car := Car.create(); // Car is a type, car is an varaible.
car.type := 'Some type etc';
certainly, this is just pros side in "case sensitivie",
if misuse, it will bring much confusing.
Anyway, when I use Delphi, I should follow the Delphi coding standard....

Best Regards.

Edited by: chen zero on Jan 10, 2018 7:58 AM
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: case sensitive [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 8:34 AM   in response to: chen zero in response to: chen zero
chen zero wrote:

I hope if Delphi can
write in this way, e.g:
Car car := Car.create(); // Car is a type, car is an varaible.

In Delphi:

var car: TCar;
 
begin
  car:=TCar.create();


or even something like:

var lCar: TCar;
 
begin
  lCar:=TCar.create;
  ...
Uffe Kousgaard

Posts: 218
Registered: 2/7/00
Re: case sensitive
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 3:20 PM   in response to: chen zero in response to: chen zero
chen zero wrote:

If, are there any tool that can be used to check code case in the pas
? e.g: an var is defined as FName, if it's refered as fName, give
some warning...

http://jedicodeformat.sourceforge.net
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Source_Code_Formatter

It would be perfect if there is a compiler directive can configure
Delphi as case sensitive...

Thanks!

No, thanks !
chen zero

Posts: 30
Registered: 5/26/00
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 10, 2018 5:46 PM   in response to: Uffe Kousgaard in response to: Uffe Kousgaard
Hi Lojas and Uffe,
Thanks for your suggestion!
After tried the Formatter in the IDE, just as Malcolm pointed out,
set "As first occurence" is really what I want, it will keep all capitalization consistent within the code.

Thank you all very much !
Richard Foersom

Posts: 10
Registered: 7/11/99
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 3:51 PM   in response to: chen zero in response to: chen zero
Chen Zero wrote:
As all of us know, Delphi is case-insensitive,

I am very happy about that. After years of working in C I really dislike case sensitivity in C and file systems. Too easy to make subtle errors while typing.

It would be perfect if there is a compiler directive can configure Delphi as case sensitive...

No, thanks.
Quentin Correll


Posts: 2,412
Registered: 12/1/99
Re: case sensitive  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 10:28 AM   in response to: chen zero in response to: chen zero
chen,

| It would be perfect if there is a compiler directive can configure
| Delphi as case sensitive...

Oh my!!! That's a *HUGH *H*LL NO!!! * [*SHUDDER!!!*]

--

Q -- XanaNews 1.20-0cfde51 - 2018-01-15 10:26:20

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02