Skip to content
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

Add a convenient way to query declaration location of operations #3388

Open
fingolfin opened this issue Apr 2, 2019 · 1 comment
Open

Add a convenient way to query declaration location of operations #3388

fingolfin opened this issue Apr 2, 2019 · 1 comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements

Comments

@fingolfin
Copy link
Member

So I just wanted to find out where the attribute Cyclotomic is declared. It took me some rummaging, until I rediscovered GET_DECLARATION_LOCATIONS -- and that only because I reviewed the PR that added it, and edited the code at various points, so I knew it was there. I imagine most other people will have a much harder time finding it, if they even try.

Let's make this useful debugging tool easier to find and use. One simple idea would be to install a more advanced Display method for operations, which also prints the location of all declarations. E.g. it could show this:

gap> Display(Cyclotomic);
<Attribute "Cyclotomic">
   declared at /SOME/PATH/.../lib/zmodnze.gd:25

With one line for each place declaring the operation. Even better would be if it also showed the filters for the declaration (possibly with help of GET_OPER_FLAGS, but that may not be enough for "nice" printing).

Of course we could instead or in addition do other things to get this information; but my thought was that Display is a relatively easy way to discover this.

We could of course also already show this information with ViewObj resp. PrintObj, but that then makes writing certain .tst file entries more problematic, as those would now hardcode paths and line numbers, and even if we "normalize" the paths (to not encoded system specific stuff into the .tst file), the line numbers are still prone to change, which then would break certain test files... Of course we might be able to avoid that by rewriting our .tst files cleveraly to not print or view operations declared in the library (that might be a good idea anyway).

@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Apr 2, 2019
@fingolfin
Copy link
Member Author

In PR #3459 the helper function ShowDeclarationsOfOperation was added which shows the relevant info. But of course that's not quite what this PR suggests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements
Projects
None yet
Development

No branches or pull requests

1 participant