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

LibGUI: Use of REGISTER_*_PROPERTY with custom getter or setter names should be minimized #22864

Open
timschumi opened this issue Jan 19, 2024 · 3 comments

Comments

@timschumi
Copy link
Member

The discrepancies between the registered getter/setter names and the name of the function that they end up calling are an ongoing source of confusion when converting applications from the runtime GML interpreter, which uses the registered properties, to the GML compiler, which doesn't use registered properties (#20518).

The following should be evaluated:

  • Convert REGISTER_*_PROPERTY calls to be strictly of the format REGISTER_*_PROPERTY(<name>, <name>, set_<name>, ...) where possible
  • Determine a better way to model read- or write-only properties (e.g. for GUI::Widget::dummy_fixed_*)
  • Remove the ability to provide custom getter and setter names completely
@AtkinsSJ
Copy link
Member

An alternative idea I've been toying with, (but haven't worked on,) is to move the property definitions into a JSON file, and use that in the GML compiler, widget initialization, and Playground's autocomplete. The benefits would be:

  • Static type checking in the compiler.
  • Playground would know what type to expect, and could autocomplete enum values.
  • The method names could be completely arbitrary but still work when compiled.
  • Replace the REGISTER_*_PROPERTY() macros with a call to a generated register_properties(qualified_class_name); function.
  • We could maybe generate some of the Widget manpages with this too?

But yeah, haven't actually started on it. 😅

@kleinesfilmroellchen
Copy link
Collaborator

kleinesfilmroellchen commented Jan 19, 2024

An alternative idea I've been toying with, (but haven't worked on,) is to move the property definitions into a JSON file, and use that in the GML compiler, widget initialization, and Playground's autocomplete. The benefits would be:

* Static type checking in the compiler.

* Playground would know what type to expect, and could autocomplete enum values.

* The method names could be completely arbitrary but still work when compiled.

* Replace the `REGISTER_*_PROPERTY()` macros with a call to a generated `register_properties(qualified_class_name);` function.

* We could maybe generate some of the Widget manpages with this too?

But yeah, haven't actually started on it. 😅

+1 for this idea

@kleinesfilmroellchen
Copy link
Collaborator

#22920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants