-
Notifications
You must be signed in to change notification settings - Fork 52
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
Redesigning Vec family API #48
Comments
So: Instead of: The advantage of the second form is that it leaves "Sub" free in the namespace to be used for other types. E.g. V2, integer vectors, etc. I think that's why I selected it. Blame a lack of function templates in go. |
What you are saying is reasonable. This namespace constraint however can be solved by creating a package for each type much like gonum does. |
Done. I haven't created an c = op(a, b) functions at this time, but it is trivial to do so. |
Awesome! I guess as soon as those functions are written we can close this issue. I am unavailable to contribute this feature. |
@soypat you could however do: n := a.f(t + dt2).Sub(a.f(t - dt2))` couldn't you? |
@aprice2704 my issue is not with the amount of lines it takes to express an operation but rather how readable the code is. I dont think methods as operations lend themeselves to readable code, in my experience |
I understand but respectfully disagree :) I find the method-operator version to be clearer, since it enforces the order in which operators are applied rather than relying on conventions from natural languages. |
At this point the vector packages have been split out into individual packages for each vector type. The rest of the code has been converted to use the new packages. At the moment the a.Op(b) for is still the main way of doing things. The Op(a,b) form is possible without leading to name space problems. Still- I haven't created these functions, because I don't feel the need. |
Using the method approach to managing vectors feels clunky and less readable than defining functions that take all vectors needed as arguments.
Compare
with
If this were to be done it could be moved to a subpackage and the methods be left for backwards compatibility
The text was updated successfully, but these errors were encountered: