Skip to content

issue 1425 - implement a new special form readConstructor - #2753

Draft
winitzki wants to merge 1 commit into
mainfrom
feature/winitzki/lang-1425-readConstructor
Draft

issue 1425 - implement a new special form readConstructor#2753
winitzki wants to merge 1 commit into
mainfrom
feature/winitzki/lang-1425-readConstructor

Conversation

@winitzki

Copy link
Copy Markdown
Collaborator

The new special form readConstructor has 1 argument, which must be an enum-like union type.

It is a parse error if readConstructor is unsaturated. It's a type error if readConstructor is used on a non-enum-like union type or on a type that is not a union type.

let a = readConstructor -- parse error
let b = readConstructor Bool -- type error
let c = readConstructor < A | B : Bool > -- type error
let d : Text  Optional <A | B > = readConstructor < A | B > -- OK
let e = d "A"  -- evaluates to Some < A | B >.A
let f = d "C"  -- evaluates to None < A | B >

@winitzki
winitzki marked this pull request as draft June 26, 2026 19:50
@winitzki
winitzki force-pushed the feature/winitzki/lang-1425-readConstructor branch from bac950b to 39e87d6 Compare June 26, 2026 20:58
@winitzki
winitzki marked this pull request as ready for review June 27, 2026 19:32
@nikita-volkov
nikita-volkov self-requested a review June 29, 2026 15:31

@nikita-volkov nikita-volkov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perfect! This will likely resolve most of my issues!

@winitzki
winitzki marked this pull request as draft July 1, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants