-
Notifications
You must be signed in to change notification settings - Fork 211
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
Simplify Varargs
API
#988
Comments
I was never fully happy with the Note that 461b72e was already a first attempt at cleaning some parts up, but we could have gone further. Some notable points:
Thanks a lot for the initiative! 👍 |
Frankly, I'm not sure if a separate length check is really necessary. Sure, doing the check before any If one really wants to do the check first before reading anything (for some JavaScript-tier method overloading, maybe), they can still just do
It would be nice to separate inherent access methods from the
I think the reason here is that I suppose it can be modified to drop the lifetime and become public, but I struggle to think of a way to actually make use of that information in user code. Whatever weird thing a user is trying to accomplish, there's probably a better way to do it than try-catching argument errors, even though I don't know what that thing is. In any case, performance is likely irrelevant here, so there isn't any reason to oppose the idea either.
Remember that The latter should be possible through |
Good reasoning, let's remove it then 🙂
Ah, right. These iterator combinations are sometimes not very obvious, maybe this could be mentioned in the |
While #886 was an interesting addition to the library, some of its decisions are dubious in necessity:
gdnative::export::IndexBounds
, whose functionalities largely duplicate the standardstd::ops::RangeBounds
trait.TryFrom
for tuple impls, which as opposed to the existingFromVarargs
:FromVarargs
types can be chained for common argument sets).VarargsError
type, that:gdnative::export::ArgumentError
type, but duplicates its functionality instead.Site
.FromVariant
conversions are meant to be done only once, because otherwise it's just unnecessary inefficiency. AccessingVarargs
in any other way is most certainly a user error, and should not be enabled by the API design.Varargs
is internally a slice should have remained an implementation detail, because there exist reasons why we might want to change that later, like in case we uncovered a source of UB during the conversion.We probably want to re-consider how much of these are actually useful to the end user, and deprecate/remove things that are mostly cruft.
The text was updated successfully, but these errors were encountered: