Hi all, I read through the spec to look for the rules about this but I think this is a consequence of a couple different parts, so I'm reaching out here for some expert help. I'm also wondering if the current state of affairs is due to a hard limitation or simply because "no one has found time to work on it yet".
Why doesn't type inference choose a named type when it is an obvious candidate, and could it be enhanced to do so without too much trouble? What I mean: https://play.golang.com/p/gWMOBr-rMgq (btw, if you're surprised to see `var myFunc MyFunc = f` works correctly in that above link, it's because there are special assignment rules for *some* unnamed types, but not all; to be clear, I understand none of these work for MyInt and I (believe I) know why it's a good thing: https://play.golang.com/p/iN0Tz5i480A) Staving off "why do you even want this?": I want to do (something like) this because I have a lisp implementation where you can register typesafe builtins from Go code, and I'm trying to emulate variable type parameters so that instead of calling CompileFunc1 for functions with 1 argument, CompileFunc2 for those with 2, etc, I can just use some CompileFuncN and have the type inference magically sort out the right type for me :) So I do already have a relatively simple way to handle this and don't need a new workaround, but I want to understand why I can't do something else. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/0532f114-7e3c-4467-8635-94070badec11n%40googlegroups.com.
