Skip to content

Consider using variable fields rather than text input fields - Marlowe blocks editor #71

@BeksOmega

Description

@BeksOmega

Diagnostic info:

  • I was using the:
    • Plutus Playground
    • Marlowe Playground
  • Link to gist with saved setup that reproduces the issue:

Description

The Marlowe text-based language requires certain values to be strings. For example, roles, parameters, and choices are all input as strings. The issue with this is that it makes it easy for users to make typos that change the meaning of their contract. I don't think there's any way to improve this situtation in the text editor, but it may be possible to improve in the blocks editor.

Blockly provides a special field called a variable field, which is normally used to represent variables, but what it actually is is a powerful way to allow the user to define identifiers.

They act like dropdowns, so it is impossible for the user to make typos when selecting identifiers.
variable-dropdown

But they differ from dropdowns in that all of the options are dynamically defined by the user (the variables page documents the common way of doing this).
variables-user-defined

They also support very powerful renaming and collision handling:
rename-variable

And they have a "type" property which can be used to create namespaces (eg separating role identifiers from choice identifiers).

I think that moving from text input fields to variable fields would make working with Marlowe a smoother, more intuitive, and less typo-prone experience.

Possible Problem

The issue with moving to variable fields is that Blockly does not provide a versioning system. So if you do things like change the name of an input, and try to deserialize XML including the old name, Blockly will fail (afaik unrecoverably). However, it seems like you peoples aren't actually storing the XML, you're storing the Marlowe representation, which means this is not a problem.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions