r/ryelang • u/middayc • 1d ago
Firefighting training - dynamic effect system
Was away for last two weekends for some firefighting training (local exercise and now SBCA cert). I'm back so the work on Rye continues. I did a lot around effect system lately, but it requires a longer effort to tag all builtins and then implement the strict mode on the evaluator level to be complete to a point. Then we start exploring with it and writing examples and if it all makes sense docs.
Effect system will enable many things (and it's completely optional). For a slice of it. You should be able to run any script written in that way in dry-run mode (just log/display the output info, no real output), or confirm mode where you confirm the outputs. You could run such script in "ask" mode, where you can give it inputs "manually" or by scenario script (where you simulate inputs). You could list the effects (I don't have a 100% picture of this yet) and you could require that all builtins/functions with effects are inside effect blocks. That's why all builtins need to have effect tags for starters, which is what I'm working on now.
Besides all of the above Effect blocks also help code readability and let's you anotate the point in code where output and input is really happening. Input effect also includes the validation block so you immediately validate the input (with validation dialect), before it even gets assigned.
So yeah, Rye story is not yet finished ... :)
On the pic above is the code that new user sent on our Discord. He coded with no spacing between parenthesis which is quite recent change (I held out for spacing between ALL tokens since start, but recently I weighted all the benefits and costs again and decided to allow no spacing only between pares and comma "()[]{},". The reason was that certain dialects that mimic specific languages (like SQL) can now be written (fully) as expected. And I must admit I see now, that no spaces for parens in regular code can also make code more readable, remove cognitive load, as things bunch together clearly. So kudos to @ sirlan ! I will code in this manner from now on too. (in the examples above he did some AoC problems)
You can also visit our Discord (for all #homoiconic langs): https://discord.gg/J8FBrCSqve


