WIP: Open and save assemblies #165
No reviewers
Labels
No labels
bug
ci
design
duplicate
engine
enhancement
formatting
maintenance
prospective
question
regression
stub
test problems
todo
ui
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
StudioInfinity/dyna3!165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Vectornaut/dyna3:open-save"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This pull request enables dyna3 to open assemblies from and save assemblies to files, resolving to-do issue #164.
Changes
Primary
Supporting
clearmethod ofAppState.exportmethod ofAssembly.declarationmethods ofElementandRegulatorand the newrepresentation_assignmentmethod ofElement. These methods' blanket implementations work for all the elements and regulators we have so far.js-systo a version wherejs_sys::PromiseimplementsIntoFuture, allowing the JavaScript promise system to be more seamlessly reflected in Rust code.Notes
js-sysanyway, we might as well go to the latest version.js-systo the latest versionThis pull request is ready for @glen to review! I've marked it as a work in progress because it needs one last change before merging: removing the old example chooser. This component has been left in during review so we can more easily spot differences in behavior with the new example chooser, which opens the example assemblies from files on the server instead of from hard-coded loading scripts.
@ -23,4 +22,3 @@# the derive macro for the `Named` trait is defined in this internal cratederive-named = { path = "derive-named" }# We use Charming to help display engine diagnosticsI personally don't think it's worth an additional line of diff just to chase the first letter of a comment from uppercase to lowercase, especially when uppercase looks perfectly normal in the existing comment.
@ -80,0 +83,4 @@fn clear(&self) {// clear the assemblylet assembly = &self.assembly;Isn't this code mis-modularized? In other words, shouldn't either (a) the assembly know how to clear itself, or (b) the state discard the current assembly and replace it with a fresh empty one? I would not expect to see code implementing how an assembly would clear itself in the implementation of a structure that contains an assembly...
Good call: refactored in commit
1a004ce. Right now, discarding and replacing the assembly would require mutating the app state, which is why I'm clearing the assembly instead. We should revisit the idea of discarding and replacing, though, If we ever redesign the app state to give the assembly field interior mutability—for example, by making it an assembly-valued signal.Feel free to also go ahead with finalizing the PR for merging. Thanks.
It is also helpful (going forward) to put notations like
Resolves #164.
in the PR description, one issue that the PR will (purportedly) resolve per line. Then they show up in the suggested commit message when one does a squash commit; and if they are in the commit message, then Gitea autocloses the corresponding issue upon merge to main.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.