Skip to content

How should ParseText results be consumed? #3868

Description

@gibson042

The value returned from ParseText is either a Parse Node or a non-empty List of SyntaxError objects, with the latter case never propagated directly (only two sites throw an exception, and neither specify it to come from the List). Instead, it is common for call sites to differentiate the two cases for either using the Parse Node or employing non-throwing fallback behavior. But the mechanism of differentiation is sometimes "parseResult is a [non-empty] List of {errors,SyntaxError objects}" and other times (although a bit less frequently) is "parseResult is [not] a Parse Node".

I'd like to establish a convention, and checking for a Parse Node is more intuitive to me, but I could live with checking for a List if that has more support.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions