-
Notifications
You must be signed in to change notification settings - Fork 56
Add InstallDeprecatedMethod #742
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
121000e
dd645c5
da685ad
0ec9785
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
InstallDeprecatedMethod := function(oldName, newName, info, filters, func) | ||
local warningMsg, newMethod, args; | ||
warningMsg := Concatenation(oldName, " is deprecated. Instead use ", newName, "."); | ||
|
||
args := Length(filters); | ||
if args = 0 then | ||
newMethod := function(args...) | ||
Warning(warningMsg); | ||
return func(); | ||
end; | ||
elif args = 1 then | ||
newMethod := function(a) | ||
Warning(warningMsg); | ||
return func(a); | ||
end; | ||
elif args = 2 then | ||
newMethod := function(a, b) | ||
Warning(warningMsg); | ||
return func(a, b); | ||
end; | ||
elif args = 3 then | ||
newMethod := function(a, b, c) | ||
Warning(warningMsg); | ||
return func(a, b, c); | ||
end; | ||
elif args = 4 then | ||
newMethod := function(a, b, c, d) | ||
Warning(warningMsg); | ||
return func(a, b, c, d); | ||
end; | ||
elif args = 5 then | ||
newMethod := function(a, b, c, d, e) | ||
Warning(warningMsg); | ||
return func(a, b, c, d, e); | ||
end; | ||
elif args = 6 then | ||
newMethod := function(a, b, c, d, e, f) | ||
Warning(warningMsg); | ||
return func(a, b, c, d, e, f); | ||
end; | ||
else | ||
Error("Unsupported args: ", args); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could just do:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah this doesn't work, hmmm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @james-d-mitchell sir, should I update this to your suggestion or try an alternative route? Or is the current implementation correct? |
||
fi; | ||
|
||
InstallMethod(oldName, info, filters, newMethod); | ||
end; | ||
|
||
DeclareDeprecatedSynonym := function(oldName, newName) | ||
local i, method; | ||
for i in [0 .. 6] do | ||
for method in MethodsOperation(newName, i) do | ||
InstallDeprecatedMethod(oldName, NameFunction(newName), method.info, method.argFilt, method.func); | ||
od; | ||
od; | ||
end; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Read("obsolete.gd"); | ||
DeclareDeprecatedSynonym("DigraphDijkstra", DigraphShortestPaths); |
Uh oh!
There was an error while loading. Please reload this page.