Opened on Oct 29, 2013 at 7:38:21 PM
Closed on Nov 4, 2013 at 7:55:10 AM
#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 , on Oct 29, 2013 at 8:00:02 PM
| Version: | 3.3.8.1 |
|---|
comment:2 by , on Oct 29, 2013 at 8:32:29 PM
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 , on Oct 31, 2013 at 6:00:52 AM
Perhaps a good way is to have Au3Check default enforcing this verification.
I assume a lot of designer use SciTE
comment:4 by , on Oct 31, 2013 at 11:50:18 AM
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 , on Nov 4, 2013 at 7:55:10 AM
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
I'm marking this as closed since there has been no further responses.

Automatic ticket cleanup.