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
{{ message }}
Repository navigation
Standard interface for programatic structure definition #7
I think it would be useful to have a standard interface for programmatic structure. Here I give the basic structure, but StructTypes related features can be added to the functions.
struct_define(struct_data::StructConstructor) # defines a struct based on the datamutable struct StructConstructor
name::Symbol
fields_names::Vector{Symbol}
fields_types::Vector{Union{DataType, Symbol, Missing}}end# a constructor for when we know the name and number of fields:functionStructConstructor(nfields::Integer)
fields_names =Vector{Symbol}(undef, nfields)
fields_names =Vector{Union{DataType, Symbol, Missing}}(undef, nfields)
returnStructConstructor(:TempName, fields_names, fields_names)
endfunctionStructConstructor(name::Symbol, nfields::Integer)
fields_names =Vector{Symbol}(undef, nfields)
fields_names =Vector{Union{DataType, Symbol, Missing}}(undef, nfields)
returnStructConstructor(name, fields_names, fields_names)
end
[comment generated via AI]
Closing: StructTypes is deprecated in favor of StructUtils.jl and takes no new features. Defining structs programmatically is outside StructTypes's scope; @eval or the packages linked above cover it.
Activity
quinnj-bot commentedon Nov 18, 2026
[comment generated via AI]
Closing: StructTypes is deprecated in favor of StructUtils.jl and takes no new features. Defining structs programmatically is outside StructTypes's scope;
@evalor the packages linked above cover it.