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
I'm nervous about the use of getters using the symbols describing the fieldnames. To my mind this defeats the entire point of an abstract interface. I appreciate the elegance those with which one can access properties of a system. I therefore want to propose to replace calls such as
sys[inds, :position]
with
sys[inds, position]
This can be formally equivalent to position(sys[inds]) but internally something more efficient can be done. Because position has its own type this means it can be done in a type-stable way, where as using a Symbol one relies on constant-propagation. (I don't know how reliable this is?)
But the biggest advantage for me is that this way one can change the internals without changing the way we access.
I'm pretty sure I agree with you. Just to make sure I understand what you're getting at here, in your second proposed option, position is now simply the function position rather than the name of a field in the object? Definitely agree that we should avoid explicitly referencing those, for precisely the reason you point out.
I'm nervous about the use of getters using the symbols describing the fieldnames. To my mind this defeats the entire point of an abstract interface. I appreciate the elegance those with which one can access properties of a system. I therefore want to propose to replace calls such as
sys[inds, :position]
with
This can be formally equivalent to
position(sys[inds])
but internally something more efficient can be done. Becauseposition
has its own type this means it can be done in a type-stable way, where as using a Symbol one relies on constant-propagation. (I don't know how reliable this is?)But the biggest advantage for me is that this way one can change the internals without changing the way we access.
A prototype of this is already in #101
The text was updated successfully, but these errors were encountered: