[idea] __set meta function parameter order

Discuss the future of the AutoHotkey language
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

[idea] __set meta function parameter order

19 Sep 2017, 07:21

In addition to the meta function ideas here, I would like to add the idea of changing __Set([Key, Key2, ...], Value) to __set(value [, key1, key2, ...]).
Pro, by example:

Code: Select all

__set(val, keys*){	; new
	; using keys and val
}
; vs
__set(p*){			; old
	val := p.pop()
	keys := p 		; for clarity but ofc not needed
	; using keys and val	
}
; Note:
__set(byref handled/result, val, keys*) ; byref param still possible
Cons: I couldn't think of any, please comment.

Cheers and thanks for reading. :)

Edit: Re: lexikos :thumbup:
Last edited by Helgef on 26 Nov 2017, 02:10, edited 1 time in total.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [idea] __set meta function parameter order

26 Nov 2017, 01:20

It will probably be done that way. It is already done that way for property-set methods, since it simplifies the implicit 'value' parameter. (Each setter has two implicit parameters: 'this' and 'value'.)

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 32 guests