Skip to content

Using a dedicated enum for the Try protocol #590

@udoprog

Description

@udoprog

While looking over #587 I realized that I'm not a huge fan of the current return value for the TRY protocol.

To summarize, since the introduction of the TRY protocol (#544) it uses Result to indicate whether the short circuit or not. While this meshes well with the existing type system (Value::Result already exists and does basically what we want it to) it lacks clarity and becomes a bit messy with types such as Result<T, Result<(), Error>>.

Here I'm proposing we adopt the ControlFlow enum for this protocol.

Internally it also means that we should be able to represent it as a Value to the degree that at least the internal Vm operations are supported, which basically means conversion to and from ControlFlow<Value, Value>.

CC: @ModProg

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions