Page 1 of 1

[idea] __set meta function parameter order

Posted: 19 Sep 2017, 07:21
by Helgef
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:

Re: [idea] __set meta function parameter order

Posted: 26 Nov 2017, 01:20
by lexikos
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'.)