Remix.run Logo
▲ tliltocatl 2 hours ago

When you need it, you need it for the whole program (including all the dependencies).

▲LoganDark an hour ago | parent | next [-]

My toy kernel says otherwise. There are many stages of boot at varying levels of abstraction and being able to conveniently express each one is wonderful.

Also think of things like embedded scripting languages. Or having a special allocator for physics objects in a game as opposed to GUI objects. Yes, you can use a global allocator tuned to the workload. You can also tune allocators for each one. You don't have to, but you can.

▲logicchains 36 minutes ago | parent [-]

>My toy kernel says otherwise. There are many stages of boot at varying levels of abstraction and being able to conveniently express each one is wonderful.

You need tight allocation control and arena usage when squeezing the most performance possible out of your system is non-negotiable. Most people don't need to write such code.

▲slopinthebag an hour ago | parent | prev [-]

rust has GlobalAlloc

▲tliltocatl an hour ago | parent [-]

Which is useless if you don't want any dynamic allocation at all.

▲stymaar 40 minutes ago | parent | next [-]

If you don't want any allocation at all, you don't need an allocator API.

But the global allocator is the response to your previous comment:

> When you need it, you need it for the whole program (including all the dependencies).

▲chiffaa an hour ago | parent | prev [-]

Then you should generally go for `no_alloc`, because std allocates, so no_std + no_alloc leaves you with core + a bunch of crates for no_std data manipulation

▲tliltocatl an hour ago | parent | next [-]

And then I have to deal with writing tons of code to please the borrow checker myself. At which point I might as well go for a language that doesn't need so much ritual.

▲LoganDark 40 minutes ago | parent [-]

Why not use an LLM to help with the actual syntax while you only need to worry about the data flow? I've found they're quite good with that.

▲logicchains 33 minutes ago | parent [-]

It's not just syntax. Depending on the allocation scheme used it can be very difficult to prove to the borrow checker that it's all safe, or even impossible (the same way some data structures in Rust can only be implemented with `unsafe`).

▲LoganDark an hour ago | parent | prev [-]

Huh, that's a thing? I thought there was just `no_std` and then you can simply leave out `extern crate alloc`.