In the last blog-post I showed a simple utility script that de-duplicates some information. I made a quick interactive solution by using just Rye console to interact with the functionality.
I still keep to the idea of language as an user interface, which this simple example was sort of.
For it to be a little better user interface, the ls function mentioned upon entering the console should only display relevant functions, not all Rye's builtin functions. This can be achieved easily with contexts. Normally, when a file evaluates, it's context is the same as the root context of the language. But I now added a --subc flag to Rye executable, which runs code in a sub-context of the root context. So ls just shows what was defined in current code.
It also makes sense for ls to show more than just word names, but also descriptions of functions. I added a "docstring" option to Rye function syntax.
Both can be seen below.
We could very simply create a context for the console with just the fix-doubles visible with ls. Other words are not listed, but are still (read-only) accessible in this case. But we can also create isolated contexts, where a console user can really call just strictly specified words and can't call anything else. See the isolates blogpost.
You can find more on github.
Komentarji
Objavite komentar