If someAbstraction is called multiple times, there will necessarily still only be one instance of the created function in-game, but it will be added to tag multiple times regardless. It is necessary to be able to add the same function to one tag multiple times, so preventing that in general is not the solution here. Instead, because it isn't desirable in most cases that calling an abstraction multiple times would add a function it requires to a tag multiple times, it would be better to do this:
An abstraction happening to need a function that needs to be in a function tag is a general use case, and tag.has would make that use case much cleaner to implement, because currently it requires the ugly monster at the top of this post to check if something is in a tag.
tag.has(value)
would be a nice alias for this:value
could be a string, whatever object type the tag is made of (e.g. anMCFunction
), or the same type of tag (e.g. a function tag).Here is an example to demonstrate that this method would be useful in general:
If
someAbstraction
is called multiple times, there will necessarily still only be one instance of the created function in-game, but it will be added totag
multiple times regardless. It is necessary to be able to add the same function to one tag multiple times, so preventing that in general is not the solution here. Instead, because it isn't desirable in most cases that calling an abstraction multiple times would add a function it requires to a tag multiple times, it would be better to do this:An abstraction happening to need a function that needs to be in a function tag is a general use case, and
tag.has
would make that use case much cleaner to implement, because currently it requires the ugly monster at the top of this post to check if something is in a tag.