Skip to content

Proposal: a simplification to pass int enums to JS side #5026

@bobzhang

Description

@bobzhang

per some discussions offline, currently

~gap:[@int] [ | [@as 0] #_0 | [@as 1] #_1 | [@as 2 ] #_2 ]

This could be simplified as:

~gap:[@int] [ #0 | #1 | #2]

or we can just encode #"1" as number 1

The problem for encoding #"1" as number 1 is that it still can not handle operations like

flag bits or operations 2 | 4 | 8

If we change the encoding, how do we handle such cases

#"2" (3)
type t = [ #"1" | #"2" | #alpha | #"23_45" ]

Shall we make it more lightweight to not need quote in the syntax?

Metadata

Metadata

Assignees

No one assigned

    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