skx / gobasic

A BASIC interpreter written in golang.

Home Page:https://blog.steve.fi/tags/basic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move eval/builtin* to their own package.

skx opened this issue · comments

We could test each built-in in isolation, of course we'd need to drop the reference to the interpreter-object - which is yet another change to our signature. Sigh.

I took a stab at this last night; 99% is fine, but we'll get an import loop if we try to pass an interpreter to the builtin-functions.

Turns out we could almost drop that - it is only our HTTP-server which sets a variable (in the SAVE primitive) which requires it.

Suggestion:

  • Switch to passing an interface, and cast it appropriately if the consumer needs it.