Skip to content

stateful run_expr #943

@ide5kllc

Description

@ide5kllc
let vm = gluon::new_vm();
vm.get_database_mut().set_implicit_prelude(true);
vm.run_io(true);

vm.run_expr::<()>("ex", r#"
  let x = 23
  ()
"#);

vm.run_expr::<i32>("ex", r#" x "); 

This gets me an error of "UndefinedVariable".

If I want do something "repl-like" where we define something in one command, then reference it in the next, is that possible in gluon ?

I tried reading https://github.com/gluon-lang/gluon/tree/master/repl/src but then got confused when it loads up https://github.com/gluon-lang/gluon/blob/master/repl/src/repl.glu

I'm trying to get a gluon REPL-ish to run on Chrome/wasm. Thus, I can't rely on the "io" stuff for now.

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