Page 1 of 1

Global EnableExplicit

Posted: Sat Sep 06, 2014 8:55 am
by uwekel
Hi,

i would like to have a setting for EnableExplicit in the compiler options and default compiler settings dialogs. Once selected, there would be no need to put the compiler directive at the top of each source code.

Best regards
Uwe

Re: Global EnableExplicit

Posted: Sat Sep 06, 2014 9:44 am
by PB
But then when you post some code here, those without that
directive won't be able to compile your code unless they type
it manually -- every time. It'll cause inconvenience to others.

Re: Global EnableExplicit

Posted: Sat Sep 06, 2014 9:53 am
by Danilo
PB wrote:But then when you post some code here, those without that
directive won't be able to compile your code unless they type
it manually -- every time. It'll cause inconvenience to others.
Nope. EnableExplicit means you have to declare all variables before use.
When removing EnableExplicit, the code still runs, as everything is properly declared already.

Re: Global EnableExplicit

Posted: Sat Sep 06, 2014 9:56 am
by PB
You're right. I wasn't thinking clearly due to my spam fight
still being on my mind. Time to have a beer and relax, I think.

Re: Global EnableExplicit

Posted: Sat Sep 06, 2014 11:07 am
by mestnyi
uwekel wrote:Hi,

i would like to have a setting for EnableExplicit in the compiler options and default compiler settings dialogs. Once selected, there would be no need to put the compiler directive at the top of each source code.

Best regards
Uwe
I would put +1 but do not know how. :oops:

Re: Global EnableExplicit

Posted: Sat Sep 06, 2014 2:51 pm
by Derren
+1 as well

There was a discussion about why there's a compiler directive instead of just natively using it. But I can't remember the reasons against it.

Re: Global EnableExplicit

Posted: Tue Sep 09, 2014 6:50 pm
by langinagel
Indifferent.
It is feasible but more effort for postings.
In case of bug test or other short *concept* scripts you have to fiddle on the compiler options.

It seems that you guys assume everyone is so professional on the style guide that every posting here would comply to Enableexplicit.
Congrats to you, keep on! But then the short line Enableexplicit should not bother you.

But there are enough amateurs like e,g, me that might post code that does not declare all variables. I would prefer to have your response as well.

Re: Global EnableExplicit

Posted: Tue Sep 09, 2014 8:09 pm
by Derren
Considering how many "help" posts could be solved with EnableExplicit, showing typos in variable names and so on, there's no reason not to use it, even for a 20 line code.

BUT, I'd like "local" counter variables as well. Explicit declaration has its merits, but not for "For" loops. Since the variable is reset anyway, it doesn't matter if it was declared before or not.

Code: Select all

Define i=20 
For i=5 To 15
  Debug i
Next
Debug i ;should be 20, not 15 (uhm, it's 16, but no idea why oO) or throw a "not defined" error if the first line wouldn't exist

Re: Global EnableExplicit

Posted: Tue Sep 09, 2014 8:21 pm
by DK_PETER
Guys...really??? :shock:
Is this really such a big deal?
A tiny one line command needs to be added to your code...
Use it or don't...Don't make a big deal out of absolutely nothing.