Re: [go-nuts] Statically get type names based on function name?

88 views
Skip to first unread message

roger peppe

unread,
Apr 25, 2013, 2:29:42 PM4/25/13
to sbde...@gmail.com, golang-nuts
See the go/parser package.
It's not too hard to work out.

On 25 April 2013 19:24, <sbde...@gmail.com> wrote:
> Let's say I have the string "net.Dial". How would I get ["string", "string"]
> as the two argument types, and ["net.Conn", "error"] as the two return
> types?
>
> Note: I'm not asking how to do this at runtime, and it doesn't even have to
> be done in Go itself (although it can be). I'm asking about statically
> analyzing the "net" package to find the function named "Dial" and to figure
> out its argument and return types as strings.
>
> --
> 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 golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

minux

unread,
Apr 25, 2013, 2:44:32 PM4/25/13
to sbde...@gmail.com, golan...@googlegroups.com

On Fri, Apr 26, 2013 at 2:31 AM, <sbde...@gmail.com> wrote:
I've had extremely bad luck using the go/ package in the past. It's always been extremely confusing, so many parts of these packages do very similar things to other parts but with slight changes. And I vaguely remember there were some caveats, where go/* had some technical limitations that made it useless for most things, but I can't remember what.
I'm very interested in what technical limitation makes the go/* packages useless for most
things.

perhaps you're talking about lack of type checker? now we have one, it lives in go.exp/go/types,
also please take a look at go.exp/ssa and esp. go.exp/ssa/interp

andrey mirtchovski

unread,
Apr 25, 2013, 3:10:33 PM4/25/13
to sbde...@gmail.com, golang-nuts
> Can you give me an example of how to do this?

Reply all
Reply to author
Forward
0 new messages