AlgebraicJulia / ACSets.jl

ACSets: Algebraic databases as in-memory data structures
https://algebraicjulia.github.io/ACSets.jl/
MIT License
18 stars 8 forks source link

Bind Julia types to AttrTypes when declaring the ACSet type #119

Closed kris-brown closed 6 months ago

kris-brown commented 6 months ago

Normally when we have attribute types we first declare an "AbsMytype" and then const a type with the Julia types instantiated.

SchLabeledSet = BasicSchema([:X], [], [:Label], [(:label,:X,:Label)])
@acset_type AbsLabeledSet(SchLabeledSet)
const LabeledSet = AbsLabeledSet{Symbol}

However often we make the schema with a particular type in mind ("of course my labels will be symbols, not some arbitrary Julia type"). We don't ever think about AbsLabeledSet. A user-friendly syntax would be

SchLabeledSet = BasicSchema([:X], [], [:Label], [(:label,:X,:Label)])
@acset_type LabeledSet(SchLabeledSet){Symbol}

The @acset_type macro would need a small tweak to handle this case.