erde-lang / erde

A programming language that compiles to Lua.
https://erde-lang.github.io
MIT License
40 stars 4 forks source link

Annoying table return in repl #9

Closed tp86 closed 1 year ago

tp86 commented 1 year ago

In Erde REPL there is annoying table: 0x.... printed after statements(?), for example

$ erde
Erde 0.5-1 on Lua 5.4 -- Copyright (C) 2021-2023 bsuth
> x = 1
table: 0x564c21b5d300
> do {
>> local x = 1
>> }
table: 0x564c21b60a90
> if true {
>> print('true')
>> }
true
table: 0x564c21b64ae0

I looked at code and it seems that every statement in REPL is surrounded by local _MODULE = {} and return _MODULE which is returned (but I don't think you can actually capture it in REPL...). Can it be somehow suppressed, so it doesn't show in REPL?

BTW, I have noticed that __erde_internal_load_source__ expects table as second parameter (options), but repl passes plain string 'stdin' (should probably be {alias = 'stdin'}).