-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Add stack option to procedures_defreturn block #74
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
base: main
Are you sure you want to change the base?
Conversation
…hen updating parameters
mark-friedman
left a comment
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.
Thanks for this! Can you verity (and maybe even add a unit test) that a workspace saved in an app which used an older version of this plugin will work as expected if loaded into an app using this newer version? Basically I just want to make sure that we don't mess up developers who upgrade their plugin.
|
Thank you for the feedback. I added a unit test that uses a block definition from the current main branch, and I also manually tested it against the current main. If you’d like me to add additional tests for specific older versions, let me know. Also, if you know a better way to manipulate mutations in unit tests than domToMutation, let me know. |
Given that the current suggested way to implement mutations is via JSON serialization using That said, users of previous versions of the plugin might have used XML serialization or JSON serialization for saving and loading workspaces. So it might be worthwhile to have unit tests for both of those scenarios. |
|
This is closely related to the question posed in #68 about adding |
|
I wrote a comment in #68 about the general issue you brought up. Regardless of the resolution of that issue, I think it makes sense to use the JSON-based mutation functions in this PR. Am I missing something? |
|
Not really. I was only making sure since it would be the first JSON functions introduced in the application and the other unit tests also use XML instead. The only thing this implies is that I need to implement the I will make the adjustments and notify you once the PR is ready for re-review. |
|
I believe that it is fine to use the XML-based mutation serialization with some blocks and JSON-based mutation serialization for other blocks. I also believe, though a little less strongly, that you can use both types of mutation serialization with either XML or JSON workspace serialization. Maybe you can test that. |
|
Note that if you have |
|
Thanks for the guide. The saveExtraState and loadExtraState methods are already functionally equivalent to mutationToDom and domToMutation. I can remove mutationToDom in this PR, but then we should probably also switch the toolbox to JSON and update the lexical variables file the same way. If you’d rather, we can defer that to a separate PR and keep the XML path intact for now. |
Sure, though the toolbox isn't really a part of the plugin, per se; it's really here just for testing.
Yeah, let's do that in a separate PR. |
|
Thanks! Do you see anything else that should be updated or adjusted? |
…efreturn-stack # Conflicts: # block-lexical-variables/src/blocks/procedures.js
|
I just thought of a couple of related points with respect to serialization. One is that unfortunately App Inventor has it's own set of save/load methods and they currently require that block's use Another, more general point, is that some apps which use this plugin, like App Inventor, are very sensitive to the size of their save files, due to cloud costs of storage and to a smaller degree of cloud network costs. So, when adding new extra state try to minimize the resulting serialization by having reasonable defaults (e.g. It's possible that @mjgallag might want to consider adding support for blocks' |
|
Thanks for the information. I’ll take another look at the size of the saved data, but this PR should only introduce a single boolean for the stack option. The other variables should keep the same default values as in XML. For existing projects (defined in XML), the definitions are converted to JSON (deserialized with I don’t have strict requirements here and am open to suggestions. I personally need the JSON definitions, but I can also extend the classes outside the plugin if that’s preferable. It may be worth waiting until we’ve looked at this issue |
Closes #26