Skip to content

Conversation

matthiasbeyer
Copy link
Contributor

These type aliases were private before.
Using them is not possible.

This patch exposes them, so users do not have to work around that limitation.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@matthiasbeyer
Copy link
Contributor Author

This pull request sets up GitHub code scanning for this repository.

No it doesn't?

@schungx
Copy link
Collaborator

schungx commented Sep 12, 2025

Ah I use them only as shorthand myself. I believe in the public interfaces they are expanded out?

At least they should...

@matthiasbeyer
Copy link
Contributor Author

Well, if you don't export them, users have to dig through your sourcecode to see what the actual type is that is aliased and copy that to their function signatures.

Exporting the aliases helps a lot here.

@schungx
Copy link
Collaborator

schungx commented Sep 12, 2025

Well, if you don't export them, users have to dig through your sourcecode to see what the actual type is that is aliased and copy that to their function signatures.

Ah, I thought it is expanded out in the docs. I suppose you mean code editors will still show the type shorthands?

@matthiasbeyer
Copy link
Contributor Author

Yes, and the aliases are also useful for the users of your library.

I just wrote some setup code where my functions return RhaiResultOf, but I had to dig through rhais source tree to find out what the actual type is, because that alias is not exposed!

@schungx
Copy link
Collaborator

schungx commented Sep 13, 2025

My thinking is... it would be easy for someone to define their own shorthand types. I'm not sure the shorthands, as they are named right now, are the best names. If we open them to public, we can no longer rename them easily in the future. Therefore, we might as well spend some more time pondering alternative names before we settle on a set...

Do you feel PERR, RhaiResultOf etc. are good?

@matthiasbeyer
Copy link
Contributor Author

Do you feel PERR, RhaiResultOf etc. are good?

TBH, no. But then they should not appear in public interfaces. If I do "rust-analyzer please tell me the signature of this call" and it gives me something that's not publicly exposed, that's frustrating.

I guess there might be some tooling that can be used in CI to ensure some stuff is not visible in public interfaces, but I forgot what the tool was.

@schungx
Copy link
Collaborator

schungx commented Sep 13, 2025

I guess there might be some tooling that can be used in CI to ensure some stuff is not visible in public interfaces, but I forgot what the tool was.

rustdoc generated docs will expand the type aliases if they are not public. I never paid enough attention to rust-analyzer...

But you can press F12 to jump to the actual definition?

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

Successfully merging this pull request may close these issues.

2 participants