Skript icon indicating copy to clipboard operation
Skript copied to clipboard

SkriptAddon#asOrigin

Open Absolutionism opened this issue 7 months ago • 5 comments

Problem

Addon developers have to go a round about way of getting a SyntaxOrigin of their SkriptAddon. Rather than a method being implemented into their SkriptAddon instance.

Solution

Adds #asOrigin in SkriptAddon which calls SyntaxOrigin#of to have a centralized spot of creating SyntaxOrigins This allows addon developers easier access to obtain a SyntaxOrigin.

Testing Completed

N/A

Supporting Information

Note from issue:

allows addons to internally cache their origin and remove the creation of a new AddonOrigin each time someone wants to use it. While they can cache it themselves it makes more sense for an addon instance to remember it themselves


Completes: #7572 Related: none

Absolutionism avatar Jun 13 '25 23:06 Absolutionism

i don't really get the point of this but i'm not against it like how is addon.asOrigin() any easier or simpler than SyntaxOrigin.of(addon)?

Where exactly is it explained how to get an addon origin other wise? Developers aren't gonna wanna go digging around SyntaxOrigin just to find a random static method that shouldn't be needed.

Additionally I feel like this should have been voiced on my issue when I initially made it. Granted I don't remember if it ever was.

Fusezion avatar Jun 13 '25 23:06 Fusezion

Where exactly is it explained how to get an addon origin other wise?

I mean, if I need a SyntaxOrigin, I'm going to go look at the SyntaxOrigin class for constructors/factory methods. I wouldn't think to go look at the addon class.

I did mention on the issue (and this is still true) that i'm not opposed, it seems like a simple enough addition. I'm just still unsure why it's wanted.

sovdeeth avatar Jun 13 '25 23:06 sovdeeth

Re reading my comment that came off a bit rude sorry

Fusezion avatar Jun 13 '25 23:06 Fusezion

Agree with sovde - I'm not sure this is necessarily serving an important purpose, as it's not really difficult to already construct an origin. It might make sense if it was being cached, but I'm not sure thats necessarily better / something that the developer couldn't do themselves

APickledWalrus avatar Jun 14 '25 14:06 APickledWalrus

I agree with pickle, this method would be more useful if the result was cached

Efnilite avatar Jun 14 '25 14:06 Efnilite