Modify

Opened 16 years ago

Closed 15 years ago

#1205 closed Feature Request (Rejected)

Dim / ReDim / Static optimization

Reported by: Nutster Owned by: Nutster
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Optimize how Dim, ReDim and Static are implemented.

Attachments (0)

Change History (7)

comment:1 by TicketCleanup, 16 years ago

Milestone: Future Release
Version: 3.3.0.0

Automatic ticket cleanup.

comment:2 by anonymous, 16 years ago

redim <array> = var

comment:3 by Valik, 16 years ago

MvGulik, please actually articulate your ideas.

comment:4 by anonymous, 16 years ago

I think there is a mismatch somewhere when it comes to ReDim with a initializer.

  • au3check generated a error in this case. (suggesting its invalid code)
  • AutoIt accepts the code and assigns the initializer to the array.variable that was used with the ReDim command. (suggesting its valid code)
  • documentation has no information about a ReDim initializer. (suggesting its invalid code)

seeing the title and comment, and thinking that ReDim with a initializer might be some old, perhaps forgotten code, ...
thats about it.

comment:5 by Nutster, 16 years ago

The following keywords will be involved in this optimization: Local, Global, Dim, Const, Static, ReDim. So much of the internal code that implements these keywords is very similar, so I will have each routine just set a few flags and then call a set of common functions. Multiple keywords set multiple flags. A list of incompatible flags are at the bottom.

Dim: SCOPE_ANY
Local: SCOPE_LOCAL
Global: SCOPE_GLOBAL
Const: FLAG_CONST | MUST_INIT | NO_EXIST
Static: FLAG_STATIC
ReDim: ACTION_RESIZE | NO_INIT | MUST_EXIST | MUST_ARRAY

If FLAG_STATIC is set for an existing static array, then it sets ACTION_RESIZE. FLAG_STATIC will skip the initializer for an existing variable. NO_EXIST gives a hard error if the variable already exists. MUST_EXIST gives a hard error if the variable does not already exist in the given scope. MUST_ARRAY gives a hard error if the variable (and script line structure) is not an array.

Incompatibles:
Getting multiple flags set that are on one line in this table will cause a hard error.
MUST_INIT, NO_INIT
MUST_EXIST, NO_EXIST
FLAG_CONST, FLAG_STATIC
SCOPE_LOCAL, SCOPE_GLOBAL (either of these overrides SCOPE_ANY)

Also review what is happening during function calls re: assigning values to parameters.

in reply to:  4 comment:6 by Nutster, 16 years ago

Replying to anonymous:

I think there is a mismatch somewhere when it comes to ReDim with a initializer.

ReDim does not take an initializer. An initializer is supposed to set the value of a new variable. ReDim is supposed to used with existing arrays. These are not compatible ideas. To rebuild an existing array into a new array, use Dim (or preferably, Local or Global).

I will check the documentation and make sure it is clear that ReDim does not get an initializer.

comment:7 by Jon, 15 years ago

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The owner will remain Nutster.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.