Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2604 closed Feature Request (Rejected)

Array access on expression & first element

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

Description

Sorry for my English

can be enabled (in Array access on expression) to read\access the first item\element directly (without specify it), example

Local $aTest1[4] = [1,2,3,4], $aTest1[4] = ["One","Two","Three","Four"], $aTest3[4][4] = [[0,1,2,3],[4,5,6,7]]
If ($aTest1) = 1 Then
	;ect ect ect
EndIf

If ($aTest2) = "One" Then
	;ect ect ect
EndIf

If ($aTest3) = 0 Then
	;ect ect ect
EndIf

Ciao.

Attachments (0)

Change History (6)

comment:1 by DXRW4E, 12 years ago

Local $aTest1[4] = [1,2,3,4], $aTest2[4] = ["One","Two","Three","Four"], $aTest3[4][4] = [[0,1,2,3],[4,5,6,7]]
If ($aTest1) = 1 Then
	;ect ect ect
EndIf

If ($aTest2) = "One" Then
	;ect ect ect
EndIf

If ($aTest3) = 0 Then
	;ect ect ect
EndIf

Ciao.

comment:2 by Matt Diesel, 12 years ago

Resolution: Rejected
Status: newclosed

Not a good idea. It would have to be a special case, that only applies when the array is used with a comparison operator as there would be other cases where it wouldn't work.

We'd probably start seeing code like:

If $a = 0 Then
    $a = 4
EndIf

A confusing feature, especially in a large code base, even with systems hungarian. For pretty much no saving either. Sure for arrays that have the count in the first index it might be nice.

I've rejected the request. PM me on the forums if you want to discuss it further, if another MVP or dev would like this feature then they can re-open the ticket.

comment:3 by TicketCleanup, 12 years ago

Version: 3.3.10.2

Automatic ticket cleanup.

comment:4 by anonymous, 12 years ago

I think you have not understood very well the (Feature) Request http://www.autoitscript.com/forum/topic/157522-array-access-on-expression-first-element/?p=1141292

Ciao.

in reply to:  2 comment:6 by DXRW4E, 12 years ago

Replying to Mat:

Not a good idea. It would have to be a special case, that only applies when the array is used with a comparison operator as there would be other cases where it wouldn't work.

We'd probably start seeing code like:

If $a = 0 Then
    $a = 4
EndIf

A confusing feature, especially in a large code base, even with systems hungarian. For pretty much no saving either. Sure for arrays that have the count in the first index it might be nice.

I've rejected the request. PM me on the forums if you want to discuss it further, if another MVP or dev would like this feature then they can re-open the ticket.

the feature already exists

    AutoIt v3.3.10.0 (23rd December, 2013) (Release)
    Added: Array access on expression: StringSplit("a,b", ",")[1]

however i asked only an improvement

Ciao.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


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