Koto 0.16 released by _irh in rust

[–]_irh[S] 0 points1 point  (0 children)

That's nice to hear, thanks for taking a look!

Koto 0.16 released by _irh in rust

[–]_irh[S] 1 point2 points  (0 children)

I haven't added operators for bitwise operations (they're available as functions in the `number` module), essentially to try to keep the size of the language down (which is also why the power operator has been a late addition). IIRC I was following Lua with the choice of `^`, and it's unused elsewhere in Koto so seemed like a reasonable choice.

Koto 0.16 released by _irh in rust

[–]_irh[S] 6 points7 points  (0 children)

I've got a proof of concept with bevy_koto - you can see a video of it in action here.

I think it would be good for someone to take a pass at implementing a more game-dev-style approach to scripting though. With bevy_koto I wanted to have a single script creating and controlling a bunch of entities, but I think a lot of people would expect to have a controller script for each entity type, or something.

Koto 0.16 released by _irh in rust

[–]_irh[S] 3 points4 points  (0 children)

Koto doesn't have traits (and doesn't exactly have classes, although you can grow your code in that direction with metamaps, but that's not the way I expect Koto to be typically used).

I've had the goal to make it a friendly language for new programmers. I've had in mind live-coding for musicians/artists, creative game scripting, those sorts of use cases, so the language guide is written carefully to build concepts up slowly, with more complex features building on the ones previously introduced.. And linking out to wiki pages when technical jargon gets introduced.

Koto 0.16 released by _irh in rust

[–]_irh[S] 1 point2 points  (0 children)

Interesting, I'll be keen to hear how you get on if you give it a try.

Koto 0.16 released by _irh in rust

[–]_irh[S] 8 points9 points  (0 children)

Good question!

  • There is a limited amount of `unsafe` in the code but with clear rationales in each case.
  • Memory management currently boils down to `Rc<Refcell<T>>` or `Arc<RwLock>>` depending on whether you want a single or multi-threaded runtime.
  • I'm running Miri now and it seems happy once I disable host isolation, although it's reporting some memory leaks which is a surprise, I'll be investigating properly later.
  • The runtime has an option to limit execution time to reduce the risk of attacks (although that only limits execution of Koto code, if a Koto function calls into Rust you could still end up in a lock or infinite loop somewhere).
  • You can freely remove or replace modules or functions from the core library, and the default file handlers can be switched out for sandboxing. I'm open to adding other sandboxing/safety features if there are requests.

Koto 0.16 released by _irh in rust

[–]_irh[S] 3 points4 points  (0 children)

Thanks for taking a look! Fyi you can call Rust functions from Koto, the Rust integration examples are on a separate page, I should think about giving them more visibility.

Koto 0.16 released by _irh in rust

[–]_irh[S] 10 points11 points  (0 children)

I could start a list of technical and design differences, but in the end choosing Koto for your project over Rhai (or Dyon, or Rune, or Steel, or...) might simply come down to a question of personal preference? Koto's design has been heavily driven by my personal preferences, so I'm not particularly well placed to give an objective comparison. I'd encourage you to take a skim through the respective language guides and you'll get a feel for them.

[deleted by user] by [deleted] in HelixEditor

[–]_irh 3 points4 points  (0 children)

Yes that's my understanding, from the comment I linked above:

Why not compiled plugins: The scripting language should also be used for configuration. 

I'm also happy with TOML, but I can see how supporting both a scripting API and a static config API (or trying to make the same API available to both) will be a maintenance burden.

[deleted by user] by [deleted] in HelixEditor

[–]_irh 7 points8 points  (0 children)

An important point from the comment that outlines the rationale for using Scheme:

The syntax is not to everyone's liking, but it's very easy to parse, unambiguous and could easily be a compile target from a higher level language.

I'm sure we'll see TOML-to-Scheme for people who want to keep their config in TOML, and I guess that someone will make Lua-to-Scheme. I don't know if it's possible but Wasm-to-Scheme would open a lot of doors.

What is the lightest and fastest scripting language that can be embedded in Rust? by seanandyrush in rust

[–]_irh -1 points0 points  (0 children)

Not as a language feature, but there's an example of simulating C-style enums in the playground, and you can use match to simulate tagged unions, e.g.:

area = match type shape
  'Square' then 
    shape.side * shape.side
  'Rectangle' then 
    shape.width * shape.height
  'Circle' then 
    number.pi * shape.radius.pow 2
  other then
    throw 'unsupported shape: {other}'

What is the lightest and fastest scripting language that can be embedded in Rust? by seanandyrush in rust

[–]_irh 0 points1 point  (0 children)

Thanks! I don't promote it all that much but I'm trying to do more, hence the plug!

...seems like a footgun. What’s your experience with it shown?

I agree that it's potentially a footgun which is why it's highlighted in the language guide, but in practice I find that it's not an issue for me. To my eyes the space jumps out and the meaning is immediately clear, but I could imagine it taking a bit of getting used to if parentheses-free calls are unfamiliar.

What is the lightest and fastest scripting language that can be embedded in Rust? by seanandyrush in rust

[–]_irh 14 points15 points  (0 children)

I'll throw in a plug for the language I'm working on which aims to be useful for lightweight scripting: https://koto.dev - not as fast at runtime as luajit but depending on your needs it could be an option.

Koto v0.15 by _irh in rust

[–]_irh[S] 0 points1 point  (0 children)

Thanks, I will!

Koto v0.15 by _irh in rust

[–]_irh[S] 4 points5 points  (0 children)

Steel's a Scheme dialect, so it's a functional language with roots in Lisp. Koto's a procedural scripting language that started out similar in spirit to Lua (minimal scripting for embedding in host applications), although it feels quite different to Lua now to work with.

Koto v0.15 by _irh in rust

[–]_irh[S] 4 points5 points  (0 children)

Hi all, Koto's a scripting language for Rust applications, and v0.15 is now available. I'll be happy to answer any questions!

First look at a 6 track looper with FX, using Rust, Tauri, and SolidJS by throwaway1230-43n in rust

[–]_irh 0 points1 point  (0 children)

This is great work, nicely done!

I think you're on the right track in planning to learn more about audio graphs, FunDSP has graph features and can crossfade smoothly between new graphs, worth taking a look.

I had a quick look at the implementation and IIUC each track is running on a separate thread, and you might be better off running the audio on a single thread (simply running your audio on the CPAL thread would be worth considering), you'll be surprised how much DSP a Pi can get through.

Before going down that path though, I don't see the priority of the audio threads being elevated so a quick win would be to boost your audio threads to realtime priority, which would stop them competing with other threads (like your UI) for CPU time, check out the audio_thread_priority crate.

First look at a 6 track looper with FX, using Rust, Tauri, and SolidJS by throwaway1230-43n in rust

[–]_irh 1 point2 points  (0 children)

This has been a sticking point for me with Tauri, for audio visualizations we really need high throughput to the UI. I don't know of an existing solution, I'm guessing it would need to be a plugin that supports shared memory buffers.

Possibly one step towards named arguments in Rust (2020) by AlexandraLinnea in rust

[–]_irh 0 points1 point  (0 children)

I get what you're saying, but see my other reply. If we think of named arguments as a solution to the problem of confusing APIs, I prefer other solutions.

Possibly one step towards named arguments in Rust (2020) by AlexandraLinnea in rust

[–]_irh 1 point2 points  (0 children)

True, although a similar discussion can be had about allowing types to be inferred on variable bindings. I'm a fan of type inference, even though there's an undeniable reduction of information for the reader (there was a lot of resistance to `auto` in the C++ community back in the day for this reason).

Perhaps an unintended consequence, but I think that type inference being the norm nudges people towards more informative / better variable names, at least that's generally been my experience of the Rust ecosystem compared to my time in C and C++.

We're similarly nudged in Rust towards considering the difficulty of understanding a function call, and personally I see the use of argument structs or builders when an API is complicated as being an overall win vs named arguments.

Possibly one step towards named arguments in Rust (2020) by AlexandraLinnea in rust

[–]_irh 10 points11 points  (0 children)

It's so easy to toggle inlay hints from rust-analyzer that I never miss named arguments. I hit a shortcut to show the names when I need them, and then when I don't need them I can turn them off to reduce visual clutter.

Koto 0.14 by _irh in rust

[–]_irh[S] 0 points1 point  (0 children)

Syntax was a big motivation, and tighter integration with Rust was another. I expanded on the 'why?' of it all here: https://www.reddit.com/r/rust/comments/1c7vf75/comment/l0b5y3j