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

Adapt reference wrappers for in/out #106

Open
Fernthedev opened this issue Dec 23, 2021 · 1 comment
Open

Adapt reference wrappers for in/out #106

Fernthedev opened this issue Dec 23, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Fernthedev
Copy link

So currently, we use ByRef<T> which works fine for ref/out but in the case that it is in passed, we don't need it to be T but rather const T. While this isn't strictly necessary, it could be nice since it's obvious we can or cannot modify T.

Hopefully, there can be an approach that also does not affect method resolution forcing you to choose between ConstRef and MutRef (coining these names today)

@sc2ad
Copy link
Owner

sc2ad commented Dec 23, 2021

To add to this, out should ALSO have its own wrapper type, one that disallows modification until it is emplaced with a value (specifically useful for cases when calling orig hooks before or after and to avoid any invalid behavior).

As far as allowing const T in ByRef goes, it MAY simply work as-is, but it might make more sense to make another wrapper type over that as well-- namely, these wrapper types should be ByRef<T> for all intents and purposes, except have overridden behavior as far as assignment and replacement is concerned.

@sc2ad sc2ad self-assigned this Dec 23, 2021
@sc2ad sc2ad added the enhancement New feature or request label Dec 23, 2021
@sc2ad sc2ad added the good first issue Good for newcomers label Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants