Skip to content

Static vs dynamic storage of element classes #195

@mattsignorelli

Description

@mattsignorelli

I see that the element stores its "class" as a static type:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions