Skip to content

Arithmetic Private Methods Changed to Public#7207

Merged
APickledWalrus merged 4 commits into
SkriptLang:dev/patchfrom
Absolutionism:dev/FixArithmetic
Dec 1, 2024
Merged

Arithmetic Private Methods Changed to Public#7207
APickledWalrus merged 4 commits into
SkriptLang:dev/patchfrom
Absolutionism:dev/FixArithmetic

Conversation

@Absolutionism
Copy link
Copy Markdown
Contributor

@Absolutionism Absolutionism 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
Copy Markdown
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
Copy Markdown
Member

Make exactDifferenceExists public as well

@Absolutionism Absolutionism changed the title Arithmetic Thingy Arithmetic Methods Update Nov 9, 2024
@Absolutionism Absolutionism changed the title Arithmetic Methods Update Arithmetic Private Methods Changed to Public Nov 9, 2024
Copy link
Copy Markdown
Contributor

@abandonedaccount6235 abandonedaccount6235 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
Copy Markdown
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
Copy Markdown
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
@abandonedaccount6235
Copy link
Copy Markdown
Contributor

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.

Burbulinis pushed a commit to Burbulinis/Skript that referenced this pull request Dec 3, 2024
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