You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> splitdef(:(function f(x::T; y) where T end))
Dict{Symbol, Any} with 6 entries:
:args => Any[:(x::T)]
:body => quote…
:kwargs => Any[:y]
:head => :function
:whereparams => Any[:T]
:name => :f
Here it would be nicer to have :head and :name first, then :args and :kwargs.
A mutable struct is nicer than a named tuple because named tuples don't print on multiple lines, and anyway it's nicer to be able to mutate the object.
For backward compatibility, such a SplitDef object could be made <: AbstractDict.
I volunteer to implement this if there is support.
Basically the same as FluxML/MacroTools.jl#116.
The motivation is not at all speed, but
def.nameinstead ofdef[:name]would be nicer (makesplitdefreturn aNamedTupleFluxML/MacroTools.jl#116 (comment))Here it would be nicer to have
:headand:namefirst, then:argsand:kwargs.A
mutable structis nicer than a named tuple because named tuples don't print on multiple lines, and anyway it's nicer to be able to mutate the object.For backward compatibility, such a
SplitDefobject could be made<: AbstractDict.I volunteer to implement this if there is support.