Skip to content

as expressions #59

@thinker227

Description

@thinker227

Add as expressions for explicit type coercion. This requires adding type names as keywords, probably contextual keywords since they could only be used after the as keyword.

let a = false as string; // "false"
let b = 2 as bool; // true
let c = () as num; // 0

Type names

Type Name
Number num
Boolean bool
Function func (same as keyword)
String string
List [] (same as list expression but without elements)
Object {} (same as object expression but without properties)
Nil ()

Unanswered questions

  • Operator precedence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions