Opened 12 years ago
Closed 12 years ago
#2517 closed Feature Request (Rejected)
MustDeclareVars=1 as default
| Reported by: | Raik | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
Because i stumbled over scripts again and again, throwing "variable used without being declared" over and over, i suggest MustDeclareVars=1 as default value, to get newbies learning a clean programming-style right from the start.
AutoIt anyway does not accept undeclared vars anymore, so its better to set this option on by default (and possibly remove it).
Attachments (0)
Change History (5)
comment:1 by , 12 years ago
| Version: | 3.3.8.1 |
|---|
comment:2 by , 12 years ago
AutoIt does still allow you to directly assign to undeclared variables, for example the following is still perfectly valid code:
$a = "Hello" MsgBox(0, "Test", $a)
But running with Opt("MustDeclareVars", 1) won't work.
Changing it to the default would break any old scripts that relied on this functionality, and I can't really think of an example where using this option would show something that is not obvious and isn't shown by Au3Check already.
comment:3 by , 12 years ago
Perhaps a good way is to have Au3Check default enforcing this verification.
I assume a lot of designer use SciTE
comment:4 by , 12 years ago
Absolutely not. You're imposing restrictions on developers for no reason other than selfishness.
What might be a good idea is to instead set the default AU3 template to set MustDeclareVars, but not do it by default. It's nonsensical to turn it off, rather than on.
comment:5 by , 12 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
I'm marking this as closed since there has been no further responses.

Automatic ticket cleanup.