On Wed, Mar 15, 2017 at 10:49:51AM +0100, denker wrote:
On 15 Mar 2017, at 10:35, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
is it possible to create a metalink on arbitrary amount of arguments?
Right now the metaObject and selector must have the same number of arguments, e.g.
MetaLink new metaObject: [ :object :selector :args | ... ]; selector: #value:value:value; arguments: #(object selector arguments)
What I would like to have instead is something like...
MetaLink new metaObject: [ :allArgs | ... ]; selector: #value:; arguments: #(object selector arguments)
And then `allArgs` would either be an array with all the arguments, or maybe a Dictionary.
Right now not⦠but it would be a nice addition.
It could either use some magic (if the number of args requested are larger then the number of args of the selector it gives the rest as a dictionary).
or, maybe better (less magic), this could be an option to be configured per link:
MetaLink new metaObject: [ :allArgs | ... ]; selector: #value:; arguments: #(object selector arguments) options: #(argsAsDictionary)
(which would allow #argsAsArray, too).
Marcus
+1 for option, magic only brings suffering. :) Peter