Thanks!
I’ve now been using Base.arg_decl_parts, which also seems to work. Any word of wisdom which of these two approaches is “better”? From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On Behalf Of Ralph Smith Sent: Friday, November 4, 2016 8:23 PM To: julia-users <julia-users@googlegroups.com> Subject: Re: [julia-users] Getting parameter names from Method julia> mt=methods(randjump) # 2 methods for generic function "randjump": randjump(r::MersenneTwister, jumps::Integer) at random.jl:145 randjump(mt::MersenneTwister, jumps::Integer, jumppoly::AbstractString) at random.jl:137 julia> mt.ms[2].lambda_template.slotnames 8-element Array{Any,1}: Symbol("#self#") :mt :jumps :jumppoly :mts Symbol("#temp#") :i :cmt julia> mt.ms[2].lambda_template.nargs 4 On Friday, November 4, 2016 at 7:00:56 PM UTC-4, David Anthoff wrote: How do I get at this nargs field? On julia 0.5 Method doesn't seem to have a field with that name? > -----Original Message----- > From: julia...@googlegroups.com <javascript:> [mailto:julia- <javascript:> > us...@googlegroups.com <javascript:> ] On Behalf Of Yichao Yu > Sent: Friday, November 4, 2016 3:54 PM > To: Julia Users <julia...@googlegroups.com <javascript:> > > Subject: Re: [julia-users] Getting parameter names from Method > > On Fri, Nov 4, 2016 at 6:31 PM, David Anthoff <ant...@berkeley.edu > <javascript:> > > wrote: > > Is there a way to get the names of the parameters of a method from a > > Method type instance on julia 0.5? > > Roughly: > > nargs tell you how many arguments the method accepts, the first one being > the object (function) being called. > The local variables names are available in the CodeInfo.slotnames and the > first nargs ones are the parameter names. > The CodeInfo can be found in the source field of the method for non- > generated functions and unspecialized.inferred for generated function. > > > > > > > > > Thanks, > > > > David