-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
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))- the keys order can be controlled:
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.
PatrickHaecker
Metadata
Metadata
Assignees
Labels
No labels