-
Notifications
You must be signed in to change notification settings - Fork 175
Support partially variadic functions like function(a, b, arg) #90
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
Support partially variadic functions like function(a, b, arg) #90
Conversation
isn't enough. Fix a bug in function object creation.
|
Seems to work nicely, also with more than 7 named arguments! How about the following example: Here Possibilities:
|
…coset Library: Next attempt at fixing Display/View/Print for cosets
|
I will add an error when arg appears as a not-final parameter. As we discussed the other approach is possible but would be more work since it needs to find a place to hide a bit more information in the function expression object. |
isn't enough. Fix a bug in function object creation.
Fix a lot of instances in lib/thread1.g where arg is used without intending its special meaning.
|
Added the error. Interestingly found a few cases of it in the library. |
|
This could probably be merged. Ideally it wants some tests, but it seems robust. |
Support partially variadic functions like function(a, b, arg) includes documentation.
|
Thanks. This also reveals another case of incorrect usage of |
|
And some more in Singular, liealgdb and wedderga packages: |
|
@james-d-mitchell - semigroups produces an error too: |
|
Would it make sense to have a special syntax for varargs when a function has multiple arguments? I am thinking of something like: I.e. three trailing dots after the last argument indicating that it's s vararg function and that the last argument should contain a list with the remaining arguments. This would avoid backwards compatibility issues with |
|
For arg used not as last argument, I can simply remove the check or downgrade it to a warning if this is preferred. A bigger problem is that some of these packages might also use arg as the last of more than one arguments, which is a syntax whose meaning is actually changed by this Extension, and which does not give an error. I'll try and check for this. |
|
This should be really easy to fix in the Semigroup package, I only introduced the code containing |
|
Running LoadAllPackages reveals use of arg not as last arguyment: In homalg at line 6299 of HiomalgFunctor.gi I have reduced the error when arg is used "not last" to a warning and added a temporary warning whenever the new syntax is read to help people convert. |
|
More problems in wedderga (PrimitiveIdempotentsNilpotent) |
|
Thanks - I should be able to update Wedderga next week. For now, I will just update the merged archive of packages used for regression tests to not to include some packages that cause problems, in order to try to deal with one problem at a time... |
|
Ok, so now the only seriously broken / breaking tests packages are LieAlgDB and Wedderga. For now, they are excluded from the merged packages archive that I am using in Jenkins tests of the master branch. |
|
Wait, so we merged this despite knowing that it breaks existing code? That seems wrong to me... Surely that means we cannot use the code in its current form, and must use some other syntax, like e.g. what Reimer proposes. Or are we really willing to break existing and widely deployed code out there for no good reason? |
|
We did not know about this prior to the merge. We were discussing yesterday that it would be nice to extend Travis tests to check manual examples and package loading as well - this would help to detect such problems before merging PRs. I think these packages used the wrong syntax, and the merge just helped to reveal this:
The fix is easy, to use another name of the argument. |
|
We do allow changes in major releases which may break some packages, otherwise we could (for instance) never add new keywords. I think in this case the clarity and naturalness of the new syntax as an extension to function( arg ) probably justifies this. I would plan on leaving the warning in through the 4.8 beta releases and removing it (or making it a compile-time switch) for the first full 4.8 release. I'd be willing to debate this further though. |
Well, of course the fix (in the sense of: the required code change in each package) is very easy. The problem is to convince package authors to apply the fix, and make releases... Also, somebody needs to contact the package maintainers, and get them to make those changes. Anyway, if this breaking change is deemd OK, then let's at least try to be pro-active about getting packages compatible... This is a change package authors can do now, after all, without any other drawbacks. So, let's collect which packages are affected, and what their status is
I hope there'll be "somebodies" to take care of the open tasks ;). In each case, sending a package authors a .patch with the relevant changes might increase the change of the change being implemented. |
|
Thanks all and thanks GitHub for the quick info: I renamed arg -> args in homalg v2015.03.31, which should now be available for download. |
|
I will take care of Wedderga package, sure. QaoS package is also affected, and it's missing in the list. |
|
In spite of this thread I've just ticked some more boxes in @fingolfin's list of packages above for those packages that are already fixed. |
Definitely not ready for merge, but presented for people to try. Turned out to be easier than I expected.