Design: Figure out how to add attributes/Tags for Models
Description of suggestion or shortcoming:
Similar to Tags for values, it would be useful to add metadata for models.
Some ideas: of things we'd want:
defaultSampleCountnameanddoc(). Doc can then be shown in the viewerversionfor the version of the modelsquiggleVersion(Acts as the default/current version, though you can still preview in other versions)presentation-> Presentation page. Often used, instead ofdefault. (Could also be calledvieworshowAsorREADMEor something.- Maybe
version, for the version of the current project. - License/permissions? Especially if the license is short.
Some ideas for syntax:
- Maybe
@@name(), and just add it anywhere. - Maybe we have one variable for the "model as a whole". Like,
model -> Tag.name("My Model Name). It's not clear what "value" this should have though. - We could use markdown-style metadata, with
--- name: "foobar" ---first.
One challenge is that we might want some of these attributes to be easy to be compared between different files that span many Squiggle versions. So for that, we might want to use some non-Squiggle syntax, like JSON or YAML or something simple. That said, this might be a small concern.
I think I kind of like a different name than "export" to be used for this, like config.
config name = "My great model"
config doc = "This is a long description of my model..."
config recommendedSampleCount = 10000
config views = {"user": doc, "editor": [varA, varB]} // or config.view and config.editorView
config author = "Ozzie Gooen"
Instead of config, we could also use tag, meta, expose, model or other.
One downside is that these vars would still interact with regular vars, which is awkward. We could chose to only make them accessible via config.name..., which might make this simpler. But then it's complicated that you write this as config name = 4 but read with config.name.
@berekuk I'd be curious to get your quick take on the above sometime.
Why "@@" is weird:
@name()
myVar = 34
@@name = 30
// node_version = 3.30
I guess a different way this could work is something like:
@name("My great model")
@doc("Long doc")
__file__ //Refers to current file.
....
__file__ = __file__ -> Tag.showAs(Calculator)