-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I see that the element stores its "class" as a static type:
AcceleratorLattice.jl/src/enum.jl
Lines 176 to 186 in a43d413
function add_ele_class(ele_class::AbstractString, description::AbstractString) | |
eval_str("abstract type $ele_class <: EleClass end") | |
eval_str("export $ele_class") | |
global doc_str = """ | |
abstract type $ele_class <: EleClass | |
Element class instance used for simulating: $description | |
""" | |
eval_str("@doc doc_str $ele_class") | |
end |
In my view, it would be better to store the class as just a String
, or potentially an enumx
, as I can't think of a use case where someone might dispatch on the element class type. Storing such information dynamically seems like a better approach and would ensure gets of the element class from an element are fully type stable.
Metadata
Metadata
Assignees
Labels
No labels