skx / gobasic

A BASIC interpreter written in golang.
https://blog.steve.fi/tags/basic/
GNU General Public License v2.0
328 stars 27 forks source link

Move INPUT to builtins.go #40

Closed skx closed 6 years ago

skx commented 6 years ago

The other primitives have to remain in our core, but INPUT could be moved.

skx commented 6 years ago

I wanted to move this because it should be standalone, and it leaves a gap in our coverage.

But it turns out I can't. INPUT sets a variable, but the builtins only get access to arguments which are "number", "string", or "error". If we called:

INPUT "prompt", dest

The function would receive the current value of dest, not a reference to it. Which means this has to be "won't fix", via "can't fix".