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

Refactor ReactiveTools macros @app, @handlers and @init #305

Merged
merged 19 commits into from
Dec 31, 2024
Merged

Conversation

hhaensel
Copy link
Member

@hhaensel hhaensel commented Nov 27, 2024

Currently, the call of the ReactiveTools macros @app, @handlers, @type, @in, etc. violate the no-side-kick principle of macros, i.e. they change the state of the program even when called with @macroexpand.
This generated strange interaction with Revise in one case.

This PR refactors all macros such that the code generated can be viewed by @macroexpanding the calls.

Here's a list of changes:

  • @app, @handlers and @init have been refactored and greatly simplified
  • @var only supports one API, support of explicit reactive types has been deprecated
  • macros @in, @out etc, have been removed, the parsing of the macro expressions is performed by the @handlers macro
  • if the @handlers macro is called without a variable section, it will not change the existing app declaration, but only add a handler; when called with a variable section, these variables will overwrite former variables and no longer add them. As before, the resulting handlers function is registered as default handler for that is called by @init
  • handling of implicit models is now a thin wrapper on top of explicit models

This PR could be a first step of a potential deprecation of implicit models; explicit models have the large advantage that multiple apps can live in one module and that they can easily share code. Moreover, they are necessary to build multi-app pages, for which another PR is in preparation #299.

@hhaensel hhaensel merged commit 2afba1c into master Dec 31, 2024
20 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant