Skip to content

Record patterns and exprs should have the same shorthand rules with normal cons #259

@osa1

Description

@osa1

With both positional and named arguments to records we couldn't allow things like (a, b) before, because the type could be (U32, Str) or (a: U32, b: Str), we couldn't tell.

Now that the positional arguments are gone (b7dcf46), we can allow this and infer (a: <type of a>, b: <type of b>).

The idea is that named cons and records should be the same other than the constructor name part.

When I have a Con(a: U32, b: Str), Con(a, b) is allowed in both expr and pat contexts. Similarly the syntax with the constructor part (a, b) should be allowed in both expr and pat contexts, as a record.

(I have some thoughts on potentially removing positional arguments from constructors, but more on this later.)

Changes in the parser should just be revert of the parser parts in b7dcf46. (the commit that removed positional fields in records)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions