Skip to content

Toplevel let in self-hosted REPL should be visible to subsequent expressions #912

@nikodemus

Description

@nikodemus
> let a = 10
10
> a * 2
10

Today the first expression is refused since let expects a dot after the binding, and even if there was something after it, the binding isn't visible afterwards.

The approximate shape of this fix seems to be:

  • Handle toplevel lets specially in parser. This means they can get their own syntax and AST nodes as well.
  • Represent the toplevel environment in REPL so that there's a dictionary of mutable variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockerPrevents current milestone from being reachedbug-langLanguage level bug

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions