-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the Model
abstract type, simplify model migration code.
#172
base: withmodel_subtype
Are you sure you want to change the base?
Conversation
typecon too allow subtyping in WithModel Change how import works. remove redundant Using Gatlab . . fix docstrings .
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## withmodel_subtype #172 +/- ##
=====================================================
- Coverage 95.56% 95.43% -0.14%
=====================================================
Files 38 38
Lines 2234 2257 +23
=====================================================
+ Hits 2135 2154 +19
- Misses 99 103 +4 ☔ View full report in Codecov by Sentry. |
Model
abstract type, simply model migration code.Model
abstract type, simplify model migration code.
@@ -75,20 +71,26 @@ struct ImplementationNotes | |||
end | |||
|
|||
""" | |||
`implements(m::Model, tag::ScopeTag) -> Union{ImplementationNotes, Nothing}` | |||
`implements(m::MyModel, tag::ScopeTag) -> Union{ImplementationNotes, Nothing}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be on the first line indented by 4 spaces to make it monospace?
|
||
using MLStyle | ||
using DataStructures: DefaultDict, OrderedDict | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this is just moved from above.
|
||
implements(m::Model, theory_module::Module) = | ||
impl_type(m, mod::Module, name::Symbol) = | ||
impl_type(m, gettag(ident(mod.Meta.theory; name))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind me what the ;name
without a kwarg does?
@@ -9,13 +9,15 @@ using StructEquality | |||
hom::HomT | |||
end | |||
|
|||
@struct_hash_equal struct SliceC{ObT, HomT, C<:Model{Tuple{ObT, HomT}}} <: Model{Tuple{SliceOb{ObT, HomT}, HomT}} | |||
@struct_hash_equal struct SliceC{ObT, HomT, C} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this massive reduction in type constraining code
This PR removes the
Model
abstract type which was overly constraining (preventing one and the samestruct
from being a model of many different theories). One purpose theModel
type served was to make it easy to see what Julia types were associated with the theory type constructors, but this functionality is now provided byimpl_type
methods which get defined by@instance
.This also led to an opportunity to simply model migration code, which is no longer handled convolutedly within the module of a
@theorymap
but instead is a function (which callseval
to create a new struct which just wraps the input model). If we start actually using model migrations and get worried about generating too many structs, it wouldn't be hard to cache the inputs to this function.All interesting changes are in
ModelInterface.jl
. Lots of tiny changes (mostly removing<: Model{...}
are in other files.