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

Models should be able to add status messages #996

Closed
hannobraun opened this issue Aug 25, 2022 · 2 comments
Closed

Models should be able to add status messages #996

hannobraun opened this issue Aug 25, 2022 · 2 comments
Labels
type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

We've recently gained the capability to show status messages in the UI. This lets the user know when a model has reloaded, or if there was an error trying to do so. So far, this is only used by Fornjot code.

There should be an API that allows models to print status message that are then shown in the UI. Models can already use println! and related Rust APIs to print to stdout/stderr, but there is currently no way for them to show information in the UI (beyond the shapes they create).

Being able to do that could help with debugging, but also allow models to display auxiliary output. For example, a model could do some limited model-specific simulation, and then output a warning if a wall ended up to thin. This is just an example. The purpose here is to give model authors the freedom to go beyond conventional use cases.

I haven't worked on the new host/model API yet, so I can't give much guidance on how to implement this, beyond the following:

  • The API has to be defined somewhere in fj's models module, presumably the Host or Context trait. I'm currently confused on why those are not the same trait.
  • Presumably, the next step it then to add whatever is required to fj's abi module, to make the new API work over the FFI boundary.
  • Finally, the new API needs to then be supported in fj-host. It needs to somehow get hooked up the the StatusReport instance that fj-host already gets access to.

If anyone wants to pick this up and has questions, feel free to ask! I'll do my best to help.

@hannobraun hannobraun added type: feature New features and improvements to existing features topic: host labels Aug 25, 2022
@hannobraun
Copy link
Owner Author

I've had a thought: Instead of creating a new API to allow models to print status message, can we instead redirect their stdout/stderr? I suspect this would be impractical right now (although I haven't really looked into it), but could it become practical once we switch the model system to WebAssembly (#71)? I think it makes sense to have WASI-based models, and maybe WASI makes it possible to control where their stdout/stderr goes.

@hannobraun
Copy link
Owner Author

This issue is no longer applicable. The affected code has been removed. See A New Direction for context.

@hannobraun hannobraun closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New features and improvements to existing features
Projects
None yet
Development

No branches or pull requests

1 participant