aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Namespace + "import gl" causes an error #254

Closed morew4rd closed 1 year ago

morew4rd commented 1 year ago

File 'repro.lobster':

namespace test
import gl

print "hello"

Running this file fails with

gl.lobster(61): error: unknown field/function reference `map`

Notes:

aardappel commented 1 year ago

Ah yes, the namespace is active until the end of the file, and since the imports don't have their own namespace, it is affecting them. The solution is to shelve the current namespace during an import.

aardappel commented 1 year ago

Fixed: https://github.com/aardappel/lobster/commit/54cb9c89f657bb7022fbc9072611d8bb0cb854a6

morew4rd commented 1 year ago

This sets my personal record for the time it took a repo owner getting a bug fixed after me filing it: 20 minutes ❤️

aardappel commented 1 year ago

I find that if its something small I understand how to fix, its quicker to just fix it then to return to it later :)