Skip to content

Conversation

@faassen
Copy link
Contributor

@faassen faassen commented Oct 22, 2024

State (through the static STATE) is modified and used throughout ext-php-rs, but it's giving rise to various problems during development - the order in which the run compiler runs things is not guaranteed, and it appears that at least in some cases (in rust analyzer?) the system gets confused. See #327.

To make this go away, I want to introduce an explicit registration mode. This is a preparatory refactor (which should introduce no behavioral changes) to help go into this direction, unweaving STATE access and modification from generation of token streams. It doesn't do anything by itself, but hopefully clears the ground.

The next step would be to see whether we can defer building and registration to a later phase. In particular, the ClassBuilder build method registers as a side-effect, though the other builders don't appear to do so.

This is a step in the direction of #329

Since git 2.23 .gitignore that is a symbolic link is ignored. I made them explicit now (though I'm not sure they're even needed)
So simplify the return value.
Our goal is to get pure functions that don't affect STATE.
It turns out the dropping and relocking state in the right order is essential for the
test suite to even complete...
Note that prepare isn't pure here as it mutates a class. We may want to rearrange things
later.
…t's state related.

It's still going to need revision later as it depends on state modification to work. The
class should only be modified once it is explicitly registered.
Copy link
Collaborator

@Xenira Xenira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!
After having a quick look this looks fine to me. Would like to do some testing before merging, as this affects core logic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if this mr builds on top of current master. A little confused seeing these changes again.

@Xenira
Copy link
Collaborator

Xenira commented Mar 13, 2025

@faassen Gonna close this as macros have changed entirely with #372.

Please let me know if something from this MR would be an improvement over the current impl.

Never the less, thanks for putting in the effort!

@Xenira Xenira closed this Mar 13, 2025
@faassen
Copy link
Contributor Author

faassen commented Mar 13, 2025

Makes sense! I am going to take a look soon!

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.

2 participants