case sensitive compiler

General FreeBASIC programming questions.
Post Reply
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

case sensitive compiler

Post by mjs »

Hi,

to make the C users feel more comfortable when using FBC, the compiler should have an option to make it work case-sensitive.

This is what I've done. The patch is on the SF page as a RFE entry ( https://sourceforge.net/tracker/index.php?func=detail&aid=1222310&group_id=122342&atid=693199 ).

Have fun with it ...

Regards,
Mark

PS: Where's the "Patches" page of this project?

EDIT: Just want to mention it: This patch also allows the compiler to compile itself in case-sensitive mode.
Shadowwolf
Posts: 341
Joined: May 27, 2005 7:01
Location: Canada
Contact:

Post by Shadowwolf »

you know doing that goes agaist basic Standers. incredibly there is such a thing. anyways one of basic defining charaterists has been that it case insenitive.

also case senitivity would really throw fb over the edge and truely make hulium statement that FB is C in a clown suit true. and that statement was made becasue pointer existed in FB.

so i think case senitivity would be just to much for us moderits to tollerated and the hardliners who already think fb blaspmis to basic would freak even more. so i can't really see this patch making it into the main stream distro.

also there is some legitiment resons not to have case senitivity. for one idotic programmer get it into there head it a good idea to name mutiple varible by the same name but with different case's making code a near nightmare to fallow.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

mjs = Mark Sibly ?
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

Shadowwolf wrote:also there is some legitiment resons not to have case senitivity. for one idotic programmer get it into there head it a good idea to name mutiple varible by the same name but with different case's making code a near nightmare to fallow.
That's the reason why I did it. However, the case-sensitivity must be switched on explicitly. Therefore: no change for all users that don't want this feature.
relsoft wrote:mjs = Mark Sibly ?
Sorry, I'm not Mark Sibly.

Regards,
Mark
Antoni
Posts: 1393
Joined: May 27, 2005 15:40
Location: Barcelona, Spain

Post by Antoni »

Well, the most important thing is we have found a person with enough knowledge to patch the compiler :D
Shadowwolf
Posts: 341
Joined: May 27, 2005 7:01
Location: Canada
Contact:

Post by Shadowwolf »

well there a few people out there that can do simple patchs for the fbc compiler only victor really understands all the details on how fbc works.
jdebord
Posts: 547
Joined: May 27, 2005 6:20
Location: Limoges, France
Contact:

Post by jdebord »

Perhaps the contributor comes from the Unix world, where everything is case-sensitive?

In any case, I would not recommend following this suggestion. I like to have FB as compatible as possible with QB.

BTW, in the QB editor, when the user changes the capitalization of a variable, all occurrences of the same variable are changed. It would be nice to have this feature in the IDE (if it is not too much complicated to program...)
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

I would love case sensitivity (as an option, of course... to appease all these delerious BASIC addicts :). Does the patch include changes to make the preprocessor case sensitive? I'll try the patch once I get back to my dev computer. If v1ctor doesn't like the patch, I'll volunteer to maintain a separate branch that allows case sensitivity... (that's a hint to accept it, please... :)
fsw
Posts: 260
Joined: May 27, 2005 6:02

Re: case sensitive compiler

Post by fsw »

mjs wrote:Hi,

to make the C users feel more comfortable when using FBC, the compiler should have an option to make it work case-sensitive.

This is what I've done. The patch is on the SF page as a RFE entry ( https://sourceforge.net/tracker/index.php?func=detail&aid=1222310&group_id=122342&atid=693199 ).

Have fun with it ...

Regards,
Mark

PS: Where's the "Patches" page of this project?

EDIT: Just want to mention it: This patch also allows the compiler to compile itself in case-sensitive mode.
COOL !

Have to test it out.

IMHO It should be added to the compiler code (if it works fine...).

I know, I know it's not the BASIC way, but hey, this only expands the possibility of fb. It's an option, you don't have to switch it on if you don't like it.

BTW suppose that from now on Vic anyway adds a lot of things to fb that are not BASIC - just to add certain functionality to fb that he wants to use in the future ;)

Thanks Mark, I like it.

One thing though:
how to use your patch file, and which fb file version is needed?
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

The patch is an input file to use with the GNU 'patch' program ( http://www.gnu.org/software/patch/patch.html ) - just do 'patch <patch_file_name.patch' in the proper directory. patch is part of the GNU diffutils, a win32 port of which is available from the mingw project.

BTW, it seems the tracker for patches is no longer visible; I guess v1ctor disabled it?
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

I don't think it's a good idea, sorry..

Say you have a case-sensitive header, used with your case-sensitive library, would you impose case-sensitiveness to all your users? While you can add alias to function prototypes, that can't be done with global vars. If you declare constants and other symbols taking the sensitiveness into account, they won't work either if the user forget a command-line option (too easy to forget) or an OPTION.

Case sensitiveness + implicit variables allocation = mess. foo Foo FOO FOo will be all different automagically-allocated variables.

The context-sensitiveness is the worst part of QB, IMO, and yet i had to add more to support escape-sequences and to remove keywords that clash with bad-designed libraries.

Hand-translated headers could stop working too, the Win API ones, SDL etc.. i'm not going to mess with that..

Without an IDE with auto-completion that supports include files, and without a "strict" name convention like in say Java, case-sensitive functions, types and (later) classes will become a nightmare if you have to look up the headers all the time when something stops compiling 'cause the function starts with say a capital letter, because the author followed his own convention.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Post by mjs »

DrV wrote:I would love case sensitivity (as an option, of course... to appease all these delerious BASIC addicts :). Does the patch include changes to make the preprocessor case sensitive? I'll try the patch once I get back to my dev computer. If v1ctor doesn't like the patch, I'll volunteer to maintain a separate branch that allows case sensitivity... (that's a hint to accept it, please... :)
Yes, this patch also affects the preprocessor. However, the normal BASIC keywords aren't affected.

And yes, it's optional and turned off by default.
v1ctor wrote:I don't think it's a good idea, sorry..
Too bad.

EDIT2: I don't think that's a problem. Users that use case-sensitive modules must use case-sensitivity too. After some time a good (?) naming style will be forced *g*.

EDIT: I'll create a final patch of all my changes and instead focus on a PB -> FB translator.

EDIT2: It doesn't make sense to fight against the world because the world will always win ... :-(

Regards,
Mark
subxero
Posts: 142
Joined: May 28, 2005 22:18
Location: Quincy, IL
Contact:

Post by subxero »

You must ask yourself one question: what in God's name is the benefit of case-sensitivity? In my opinion, it only adds room for human error and doesn't speed up anything, by any means. Name one situation where you'd need two variables with the same human-readable name, but separated only by capitalization.

Also, I don't want to start anything with anyone. I'm in agreement with v1c: he brings up perfectly valid points. I also agree that the BASIC languages are not meant to be case-sensitive, or we wouldn't have all the different capitalizations for FreeBASIC ;-) (Or might it be freeBASIC, or FreeBasic? Anyone?)
dumbledore
Posts: 680
Joined: May 28, 2005 1:11
Contact:

Post by dumbledore »

besides, someone requested automatic variable-name capitalization for fbide, if that's added, it'll be nearly impossible to do foo foO Foo fOo etc because the ide will change them all to the same variable :P
Post Reply