-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
C#: Deprecate accessor methods and generate correct int and float types #28423
C#: Deprecate accessor methods and generate correct int and float types #28423
Conversation
- Normal log messages are no longer warnings. - BindingsGenerator is no longer a singleton. - Added a log function.
- Methods that act as accessors for properties in the same class (like `GetPosition` and `SetPosition` are for `Position`) are now marked as obsolete. They will be made private in the future.
a92bfad
to
f2b35eb
Compare
core/object.h
Outdated
METADATA_INT_IS_UI64, | ||
METADATA_REAL_IS_FLOAT, | ||
METADATA_REAL_IS_DOUBLE | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reduz Are you fine with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, please do the following:
- use a property usage for unsigned
- use another property usage for 64 bits
There is no point at all in supporting 8 and 16 bits. I prefer this rather than adding yet another field to property info (which is used everywhere), which is just bloat for something so core, and confusing to anyone reading the code.
I know it may bother you to not have the only 4 functions in the whole bindings (which are very rarely used) exposed exactly as they are, but please understand it bothers me a lot more to have to add an extra field to PropertyInfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see the point in avoiding the bloat of adding a field to a struct that is used everywhere. What if we surround it with #ifdef DEBUG_METHODS_ENABLED
?
I can't take the second statement seriously. This code couldn't be simpler. I can't imagine anyone getting confused by it, let alone annoyed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very serious about it, a PR like this won't go through. My first priority will always be to keep bloat out of core and this is an extremely core class. If for you this inconsistency is unacceptable, I prefer to remove the 4 occurrences of the < 32 bits arguments so there are no longer any functions using them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean surrounding #ifdef DEBUG_METHODS_ENABLED
is not an option? If not, I'm thinking of an alternative to having the field in PropertyInfo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, please let's not add hack to that. Definitely go the property usage way and let's get rid of 8/16 bit access if you need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even modern processors don't really support this type of access, it's a thing of the past.
@karroffel The int/float commit may be of use for GDNative. |
core/object.h
Outdated
METADATA_INT_IS_UI64, | ||
METADATA_REAL_IS_FLOAT, | ||
METADATA_REAL_IS_DOUBLE | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, please do the following:
- use a property usage for unsigned
- use another property usage for 64 bits
There is no point at all in supporting 8 and 16 bits. I prefer this rather than adding yet another field to property info (which is used everywhere), which is just bloat for something so core, and confusing to anyone reading the code.
I know it may bother you to not have the only 4 functions in the whole bindings (which are very rarely used) exposed exactly as they are, but please understand it bothers me a lot more to have to add an extra field to PropertyInfo.
core/object.h
Outdated
METADATA_INT_IS_UI64, | ||
METADATA_REAL_IS_FLOAT, | ||
METADATA_REAL_IS_DOUBLE | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very serious about it, a PR like this won't go through. My first priority will always be to keep bloat out of core and this is an extremely core class. If for you this inconsistency is unacceptable, I prefer to remove the 4 occurrences of the < 32 bits arguments so there are no longer any functions using them.
e044b17
to
49bd240
Compare
49bd240
to
3380565
Compare
Tried it in a different way as a last attempt. Let me know if you don't like this one either. |
I really still think you are over complicating it. That will make it more difficult for those writing binders to understand what it is, and it will add strings to everything that has bindings (I know they are stringnames so it's just a pointer, but still.). The doc generators or code completion may also get confused (or need to take this into consideration) with this given they also use it. I keep insisting on the approach I proposed and drop 8 and 16 bits. I can remove them from the API if you want, as they are useless. |
This change doesn't affect any existing binders. If they don't decide to use it, nothing changes for them.
I don't understand what you mean. This code is not using String nor StringName at all. All the code in this commit that uses StringName is in the C# bindings generator.
The doc generators and code completion won't use this AFAIK. GDScript only supports int (64bit integer) so there is no point in using this, and as I said this doesn't break any existing code, it's a completely opt-in thing. |
I would rather do it this way, but I don't really mind doing it the way you suggested if you ultimately decide so (there are only a few places using byte and short any way). I just don't understand these points. |
Nevermind, I misread the PR. I guess this is OK. |
Thanks! |
This does not change the way |
@karroffel It does not change anything in ptrcall. This is metadata you can optionally use when generating bindings for a language. If a C# method has a parameter of type |
GetPosition
andSetPosition
are forPosition
) are now marked as obsolete. They will be made private in the future.