nings-archive / slang

An open-source interpreter for The Source
0 stars 0 forks source link

Keyword WEEK is in the wrong scope #5

Closed ning-y closed 6 years ago

ning-y commented 6 years ago

I meant to introduce a built-in constant WEEK, that would hold a number (integer) value corresponding to the 'version' of source currently in use. I.e., for a REPL running source week 3:

>>> WEEK
3

This used to be implemented here, before the introduction of the custom eval function sourceEval.

With sourceEval, however, all commands are passed through the sourceEval context instead of the repl_obj context.

A fix will likely involve defining WEEK in sourceCtxt instead of repl_obj.context.

We should also be prepared to rename this to the new naming convention (I think it was chapter?), which may require a string instead of a number.