Modify

Opened 15 years ago

Closed 14 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 Changed 15 years ago by TicketCleanup

  • Milestone Future Release deleted
  • Version 3.3.0.0 deleted

Automatic ticket cleanup.

comment:2 Changed 15 years ago by anonymous

redim <array> = var

comment:3 Changed 15 years ago by Valik

MvGulik, please actually articulate your ideas.

comment:4 follow-up: Changed 15 years ago by anonymous

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 Changed 15 years ago by Nutster

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.

comment:6 in reply to: ↑ 4 Changed 15 years ago by Nutster

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 Changed 14 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Nutster.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.