allow more Param types#39
Conversation
5ee3cc9 to
285168e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39 +/- ##
==========================================
+ Coverage 79.88% 81.00% +1.12%
==========================================
Files 4 4
Lines 174 179 +5
==========================================
+ Hits 139 145 +6
+ Misses 35 34 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Could I get some context on this? Why is this necessary? It seems to me that filtering is already possible by table operations on |
|
The original design always had But I get your point, there are 2 ways of achieving this - table/vector manipulation outside of the object, or modification of the param type. This way is going to be better for type stability where that's required, and is pretty easy to specify by the user. But its also less flexible. |
|
I know the original design had I'm not sure this is better for type stability. The main type stability issue in using So, for example, if one works only with In other words, I don't think this is the main problem hindering type stability... or am I missing something? |
| end | ||
| # TODO do this with lenses | ||
| @inline function _setindex(obj, xs::Tuple, nm::Symbol) | ||
| @inline function _setindex(obj, xs::Tuple, nm::Symbol; select=SELECT, ignore=IGNORE) |
There was a problem hiding this comment.
Should select and ignore maybe have type bounds, Type{T} where {T<:AbstractParam}?
| @test isa(tuplegroups.B.j, Tuple) | ||
| end | ||
|
|
||
| struct FreeParam{T,P<:NamedTuple} <: AbstractParam{T} |
There was a problem hiding this comment.
If we're going to do this, then the macro to abstract away this boilerplate (and reduce chance of user error) should be included in this PR, I think.
| FreeParam(val; kwargs...) = FreeParam((; val=val, kwargs...)) | ||
| FreeParam(; kwargs...) = FreeParam((; kwargs...)) | ||
|
|
||
| @testset "spefify param type" begin |
There was a problem hiding this comment.
Since you seem to agree that the FreeParam/FixedParam is not a good use-case for this feature, I would like to see an example use-case where this feature actually is actually necessary in contrast to using table manipulations, i.e. something where simply adding an extra field to Param wouldn't cut it or would be prohibitively difficult. I can't really think of one off the top of my head, but maybe you can.
|
I have changed my mind about this, but I think the changes here will conflict a lot with #44, so it might be better for me to simply copy these changes into that PR by hand rather than try to resolve the merge conflicts. |
|
Nice to see you finally came around ;) Probably making a separate PR afterwards is better, or do you need this for your PR? |
|
We can do it in another PR. |
@briochemc this PR addes
selectkeywords everywhere so that we can filter by other wrapper types - e.g.AbstractParam. (andignorefor the case there are types in your object that don't reconstruct, but that's a minor detail)@bgroenks96 you might want to have a look at this and give some feedback. We will need to changing the grouping as well to not always use
Param.But, from the new tests, this is the kind of this it adds with
select:Probably we want a
@param MyParammacro to define all those constructors automatically