Rye is at this point focused on becoming a useful tool for use in Linux shell (the server/back-end tasks). So I integrate it with the libraries that make sense there and I also like to improve the whole terminal capability of Rye.
I got some idea (one of many of this kind, we will see how this one goes :P) that I could make a set of interactive tasks, that could teach my two kids (and others potentially) about how the computer works, and how you can work with a computer through Linux shell. For this I would need some sort of interactive terminal based user interface, I imagined something chat like.
See how the "game" looks in action with asciinema.
Above is a small demo of the idea after a day of work on it. It's in form o a very very small text based adventure game :).
To make this work I needed to create basically 2 functions, chat (and chat-lines for now) and choice. I wanted to use short, context specific words to do all this so I created it inside a chat-tui context. And also I use the code by executing it inside that context using the word do-in.
Rye contexts are very malleable, you can string them together, isolate them, join them, extend them etc. Context could be seen (or used) as an Object, but we generally don't want to store state in them, like it is done with object oriented programming.
Rye also got a new function wrap. It takes two blocks of code, it executes first one, then the second one and then again the first one. It seems for now it should return the result of the middle evaluation.
Another such combinator function is pass. It accepts a Rye value (first argument) and a block of code, it evaluates the code by injecting the value, but it still returns (passes) the first argument forward.
The name and ideas for them are very loosely based on Factor's dataflow combinators , which were able to cover many common data or code flow patterns without using stack shuffling words in the case of factor, or variables in the case of Rye.
or our reddit group if you want to chat: https://www.reddit.com/r/ryelang/
Komentarji
Objavite komentar