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

Arithmetic Private Methods Changed to Public #7207

Merged

Conversation

TheAbsolutionism
Copy link
Contributor

@TheAbsolutionism TheAbsolutionism commented Nov 9, 2024

Description

This PR aims to change the exactOperationExists method within the Arithmetic class allowing skript-addons to ensure an operation does or does not already exist if registered by another addon.


Target Minecraft Versions: any
Requirements: none
Related Issues: #7206

@Moderocky
Copy link
Member

Please put a little more effort into writing your PR name/description: these are auto-exported in change history & difference logs and it won't be very clear when searching through the contribution history what "thingy" is or what this is "fixing"

@UnderscoreTud
Copy link
Member

Make exactDifferenceExists public as well

@TheAbsolutionism TheAbsolutionism changed the title Arithmetic Thingy Arithmetic Methods Update Nov 9, 2024
@TheAbsolutionism TheAbsolutionism changed the title Arithmetic Methods Update Arithmetic Private Methods Changed to Public Nov 9, 2024
Copy link
Member

@Pikachu920 Pikachu920 left a comment

Choose a reason for hiding this comment

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

I think making these public is not the right way for addon devs to accomplish this. if registration fails, a skriptapiexception is thrown and can be caught by the caller

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Nov 16, 2024
@sovdeeth
Copy link
Member

I think making these public is not the right way for addon devs to accomplish this. if registration fails, a skriptapiexception is thrown and can be caught by the caller

I think it'd be nicer to know whether it will works or not prior to doing all the work to make the arithmetic. Do you foresee a reason that exposing these methods would be negative?

@APickledWalrus
Copy link
Member

I think making these public is not the right way for addon devs to accomplish this. if registration fails, a skriptapiexception is thrown and can be caught by the caller

The same (similar in practice) methods are public for developers. Exception handling is unnecessarily heavy when this exists as a safe option we can provide. I will merge this in for now, but we can revisit this practice across all registries where it exists.

@APickledWalrus APickledWalrus merged commit 6a31b7e into SkriptLang:dev/patch Dec 1, 2024
7 checks passed
@Pikachu920
Copy link
Member

I think making these public is not the right way for addon devs to accomplish this. if registration fails, a skriptapiexception is thrown and can be caught by the caller

The same (similar in practice) methods are public for developers. Exception handling is unnecessarily heavy when this exists as a safe option we can provide. I will merge this in for now, but we can revisit this practice across all registries where it exists.

Yeah, but the problem is that this is exposing implementation details. The caller doesn't want to know whether an exact operation already exists, they want to know whether it is acceptable to register the operation. Calling exactOperationExists isn't sufficient for that goal, because there may be other exceptional conditions (i.e. calling register after registration closes, or some change in the future).

If the intent is to allow addon devs to check if a registration is acceptable, I think we should add a method specifically intended for that instead of exposing the utility methods that power the existing check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants