Skip to content

Add proper support for escape manipulation by Actions#1047

Open
Robotgiggle wants to merge 13 commits into
mainfrom
paren-refactor
Open

Add proper support for escape manipulation by Actions#1047
Robotgiggle wants to merge 13 commits into
mainfrom
paren-refactor

Conversation

@Robotgiggle
Copy link
Copy Markdown
Member

@Robotgiggle Robotgiggle commented May 14, 2026

Adds the operateInParens method to allow Actions to define custom behavior when executed inside parentheses, and removes all the hardcoded jank that was used to do this before.

This enables the previously hardcoded patterns for escape manipulation (Consideration, Introspection, Retrospection, and Evanition) to be turned into normal Actions, and also makes it possible to add new escape manipulators in addons or future updates.

Also fixes #1077 by adding a new mishap for when Evanition has nothing to remove.

Copy link
Copy Markdown
Member

@object-Object object-Object left a comment

Choose a reason for hiding this comment

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

Didn't fully review (am on a phone), but skimmed and noticed some problematic breaking changes.

Comment thread Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java
@github-project-automation github-project-automation Bot moved this from 📋 Backlog to 🏗 In progress in Hex Casting May 14, 2026
Copy link
Copy Markdown
Member

@object-Object object-Object left a comment

Choose a reason for hiding this comment

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

This is coming along! Overall this change looks pretty good, and it's nice to make the VM less hardcoded; however, there are some things in the API that could be cleaned up, as well as some potential refactors and documentation improvements.

Comment thread Common/src/main/java/at/petrak/hexcasting/api/HexAPI.java
Comment thread Common/src/main/java/at/petrak/hexcasting/api/casting/iota/Iota.java Outdated
Comment thread Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java Outdated
Comment thread CHANGELOG.md
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we also document that Hasty Retrospection was renamed to Absent Introspection?

Comment thread Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/CastingImage.kt Outdated
* The behavior of this action when inside parentheses. By default, this is just to add the pattern
* to the parenthesized list without updating the op count or performing any of its usual effects.
*/
@Throws(Mishap::class)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, is it really a good idea to allow addons to throw mishaps while parenthesized? Do we handle this correctly? I don't think any base hex pattern currently does this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Throwing mishaps while parenthesized will be necessary to address the Evanition issue you mentioned above, along with a plan I have for a read-from-offhand-into-parens pattern. Also, I see no reason why allowing addons to do that would be problematic - imo it's better to natively allow interesting functionality like that rather than forcing people to make their own workarounds.

As for handling, any thrown mishap will be caught and handled by the try/catch in Iota.lookupAndOperate, exactly like a mishap thrown from the normal Action.operate method.

Comment thread Common/src/main/java/at/petrak/hexcasting/api/casting/castables/Action.kt Outdated
Comment thread Common/src/main/java/at/petrak/hexcasting/api/casting/eval/vm/CastingImage.kt Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

Evanition has a weird failure state if there's nothing to undo

2 participants