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

lib: improve LocationFunc for kernel funcs #2225

Merged
merged 1 commit into from
Mar 9, 2018

Conversation

fingolfin
Copy link
Member

Before:

gap> LocationFunc(APPEND_LIST_INTR);
""

After:

gap> LocationFunc(APPEND_LIST_INTR);
"src/listfunc.c:APPEND_LIST_INTR"

@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Mar 1, 2018
@frankluebeck
Copy link
Member

I wasn't aware of the function LocationFunc. You may want to look at the code of PageSource, try

gap> PageSource(PageSource);

This could already handle many kernel functions, like

gap> PageSource(APPEND_LIST_INTR);

(it is also showing the location in the terminal). PageSource can also show the locations of declarations of operations. Maybe you want to add that to LocationFunc as well.

gap> PageSource(Size);
gap> PageSource(Size, 2);

@fingolfin
Copy link
Member Author

I was aware of PageSource, but it's not useful for me. I use my own function which opens the relevant file in an editor at the right position.

But this all seems irrelevant to this PR: LocationFunc is mainly useful to me to produce error messages, or for other kinds of debug output (e.g. to give a list of locations of methods and where they are defined; indeed, that's what it is used for in ApplicableMethodTypes.

@fingolfin
Copy link
Member Author

I am also aware of the fact that PageSource knows how to locate operations (I was reviewer of the PR adding it, after all ;-), and even thought briefly about adding it to LocationFunc , but since it can return multiple results, it didn't strike me as that useful for LocationFunc, at least without bigger changes to its API. Since this goes way beyond the little itch I want to fix with this PR, I have no interest in pursuing it at this time for LocationFunc.

Copy link
Contributor

@ChrisJefferson ChrisJefferson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a little test, just to make sure we don't break this functionality at some point.

Before:

    gap> LocationFunc(APPEND_LIST_INTR);
    ""

After:

    gap> LocationFunc(APPEND_LIST_INTR);
    "src/listfunc.c:APPEND_LIST_INTR"
@fingolfin
Copy link
Member Author

Just added a test, let's see if it passes CI.

@ChrisJefferson ChrisJefferson merged commit 00c0720 into gap-system:master Mar 9, 2018
@fingolfin fingolfin deleted the mh/LocationFunc branch March 10, 2018 11:52
@fingolfin fingolfin added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Sep 20, 2018
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 release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants