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

Better introspection for @attr methods #1787

Open
fingolfin opened this issue Sep 16, 2024 · 1 comment
Open

Better introspection for @attr methods #1787

fingolfin opened this issue Sep 16, 2024 · 1 comment

Comments

@fingolfin
Copy link
Member

It would be nice if there was a way to reach the "inner" function for a method declared with @attr.

So e.g. if we have

@attr Any function bla(x::Int)
   X
   Y
   Z
end

then it would be nice if there was a way to call the code X ; Y; Z in the definition of bla, while bypassing the attribute based caching of the return value.

This is useful so that one can run e.g. @code_warntype on it, or generally invoke it while bypassing the caching logic which @attr inserts around it.

@lgoettgens
Copy link
Collaborator

There is of course __compute_bla__(x::Int) that does the internal computation of the @attr macro there. We could add something like this to the @attr docstring, and maybe add a note that this construction may change between different AA versions, so people don't use it in normal code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants