You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The extern "C" stuff required for the dynamic library isn't great. And the way parameters are passed to the model has caused further pain. Ideally, creating a model should require little or no ceremony to satisfy the plugin system. Maybe something like this would be good:
/// Defines the model parameters////// The `derive` makes the parameter parsing just work, so the user doesn't have/// to think about it. Preferably in a way that moves the bulk of the work to/// the host, so compile times for the model stay low.#[derive(fj::Parameters)]pubstructSpacer{pubouter:f64,pubinner:f64,pubheight:f64,}impl fj::ModelforSpacer{/// Defines the model itself/// /// Has access to the parameters through `self`. Method is defined in a/// trait, to provide type safety.fnmodel(&self) -> fj::Shape{// define the model}}
This is just a sketch, not to be taken too seriously. Maybe it's possible, or maybe a #[no_mangle] or something will still be required.
Technology
Aside from the convenience of defining the model, the ideal technology is also a bit of an open question. I've decided to go with dynamic linking initially, as that seemed like a good way to get started (which turned out to be correct). But WebAssembly seems like a stronger candidate long-term:
It provides sandboxing, which could alleviate security concerns. At some point, people might want to look at models from untrusted sources.
It provides a path for running on the web. I'd like to be able to integrate Fornjot models into websites, in an interactive way that allows people to change model parameters. I'm not sure how the implementation would look in detail, but if models are WASM modules, that seems like a step in the right direction.
On non-web platforms, something like Wasmtime or Wasmer could be used.
The text was updated successfully, but these errors were encountered:
Convenience
The
extern "C"
stuff required for the dynamic library isn't great. And the way parameters are passed to the model has caused further pain. Ideally, creating a model should require little or no ceremony to satisfy the plugin system. Maybe something like this would be good:This is just a sketch, not to be taken too seriously. Maybe it's possible, or maybe a
#[no_mangle]
or something will still be required.Technology
Aside from the convenience of defining the model, the ideal technology is also a bit of an open question. I've decided to go with dynamic linking initially, as that seemed like a good way to get started (which turned out to be correct). But WebAssembly seems like a stronger candidate long-term:
The text was updated successfully, but these errors were encountered: