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

Add technical note and caveats of data objects #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion articles/scripting-expressions-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ new(
)
```

The example above projects the two unnamed items of a tuple into a new data object with an `X` and a `Y` property.
The example above projects the two unnamed items of a tuple into a new data object with an `X` and a `Y` property.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would include a short one line Tip on what are the cases where these dynamic classes are suited for. I would include operators that leverage attribute names (Writers and Visualizers) and general code sanitization where dynamic classes are serve to increase readability of workflows.

> [!Note]
> Dynamic data classes are uniquely identified by their specification. If two data object initializers use matching property names with identical types declared in the same order, then the two expressions will be resolved to the same data object type. This allows type inference to work on reactive operators which require matching types in all the input sequences, e.g. [`Merge`](xref:Bonsai.Reactive.Merge).

> [!Warning]
> Dynamic data classes do not have a predictable type signature and therefore cannot currently be serialized in the workflow file, nor be used in custom scripting extensions.
glopesdev marked this conversation as resolved.
Show resolved Hide resolved