Modify

#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, on Jan 4, 2014 at 11:42:30 PM

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, on Jan 4, 2014 at 11:58:48 PM

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, on Jan 5, 2014 at 12:00:01 AM

Version: 3.3.10.2

Automatic ticket cleanup.

in reply to:  2 comment:6 by DXRW4E, on Jan 5, 2014 at 2:14:31 AM

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.