Koto Programming Language
28 points by stip
28 points by stip
Nice language!
This is quite possibly one of the most beautiful scripting languages I’ve seen. I read through the entire language guide, which I usually close after the first few disastrous design decisions whenever new languages pop up.
This one, however, got me through to the end. The only thing I felt even remotely strong about at first glance was the fact that @test
functions run even at runtime. I suppose this isn’t necessarily a bad thing, and I’m not entirely sure how I feel about it. It’s definitely different.
Well thought out, clear, sensible, boring and beautiful at the same time. Really enjoyed this, will play with it a bit later.
I’m the creator of Koto and just signed up to reply, thanks for the kind words!
I should clarify in the guide that @test
functions are only run if the runtime’s ‘run tests’ setting is enabled. The setting is enabled by default, and can be disabled by the host application when it makes sense, e.g. in deployment builds.
In the CLI, tests are actually disabled by default, with a -t
switch to enable tests for the script that you’re running directly, or -T
to enable all tests including for any imported modules. I think this makes sense for the CLI, and it might be a clue that the setting should be disabled by default in the API, but for now I think I’ll wait and see if it causes problems in practice.
I’ve been using Rhai as an embedded scripting language for a Rust project. It was mostly pretty smooth—certainly easy to embed in Rust—but for three big difficulties:
user.to_string()
, but then you can’t have any other type with a to_string
method!Option
. Nevermind other ADTs.Scope
when running a script, the variables in the Scope
will be visible inside closures but not inside functions. It’s all documented, but the result is that innocent changes will break your scripts, and you need to learn the idiosyncrasies of Rhai to do some fairly simple things.At a glance I’m hopeful that Koto avoids these difficulties, so I’m excited to see it!
Probably would make more sense to link to https://koto.dev/about/ The front page is quite empty
Excited to imagine what I could do in Bevy with Koto and to see what others do with it! I have a rogue
-like project (terminal interface and all) that could benefit significantly from prototyping and scripting NPC AI, item interactions, and the like with this. I’m so very glad for the piping syntax, too.
I’m also interested in using Koto with Bevy, I’ve been experimenting at https://github.com/koto-lang/bevy_koto/ (using the dev
branch while Koto 0.16 is under development).
I’m not sure that the approach I’ve taken there is going to be suitable for general purpose game engine scripting, I was more thinking along the lines of building a LÖVE style framework on top of Bevy rather attaching scripts to game entities, but it might be useful as a starting point. If you try it out please let me know how you get on!
Fantastic! Thank you so much for providing that.
And I just realized how perfectly Koto could work for visual novels. The DSL practically writes itself, especially with the piping function. Something like this!
protag = character("protag.yaml")
leftSide = position(0.2, 0.3)
protag silent
protag "Ow! Where did that truck come from?" -> fadeIn 0.5 -> at leftSide -> show
Guess what I know what I’m doing for my next game dev learning project!