So, currently, methods that take multiple argument lists are treated like second-class citizens in a lot of places. For example, value argument/parameter lists other than the first one are not considered when resolving an overloaded reference.
Personally, I find this to be totally wrong (which is why I currently have on the back-burner a proposal to change how overload resolution works. I can post my in-progress specification proposal if anyone cares to see or comment, I guess... ), but that's not directly the reason for this post.Rather, I'm writing it because, currently, the reflection API also treats value parameter lists other than the primary list as second-class citizens in a lot of places. For example, MethodType.params
returns a List[Symbol] containing only Symbols representing the parameters in the initial value parameter list, rather than List[List[Symbol]] that I believe it should return. Also, TermSymbol.resolveOverloaded takes a single Seq[Type] to represent the types of the arguments in the first value parameter list, rather than taking a List[List[Type]] and only using the head like I would advocate.
I'm sure that there are other examples, these are just the ones that come to mind immediately.I think that this is a mistake. I think it compromises Martin's stated goal of doing the reflection API right the first time.
Yes, I am partially motivated by a self-serving desire to get the reflection API into a state where the language changes that I want to propose are closer to being drop-in method logic replacements (rather than needing signature changes), but I am also motivated by my earnest beliefs that1) Multiple parameter list methods are part of the language. A reflection API is supposed to reify the language. Therefore, therefore, reflection should fully acknowlege them.
2) More generally, if Scala is going to have have multiple parameter list methods as a feature, it should own that feature. It should be well-supported and well-integrated into the language.
Multiparamlist methods have returnType of type MethodType. Inspecting that one will uncover subsequent parameter list(s).
Multiparamlist methods have returnType of type MethodType. Inspecting that one will uncover subsequent parameter list(s).
There should be "paramss" (at least in the compiler internals, it's there)
On Fri, Jul 6, 2012 at 5:11 AM, Lukas Rytz <lukas...@epfl.ch> wrote:There should be "paramss" (at least in the compiler internals, it's there)
Indeed, and looking at the implementation would also have led us to where the others the others were hiding:
override def paramss: List[List[Symbol]] = params :: resultType.paramss
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The answer to this should be obvious. We do what I said up front and make parameter lists first class. Now you can tell one thing from another, and there is an easy option to create implicits for the single parameter list case. You obviously can't create implicits from List[] to List[List[], but you can from paramlist to paramlists.
Perhaps paramlist can be plain List[] and you only need class(es) for paramlists (custom list of List[])?