TBF Rust v1.100 makes a big leap in permitting custom allocators, but mandating would be ideal in the spirit of "explicit is better implicit". I like adding lints to defend against some of these footguns, but more compiler-driven transparency around quiet allocations would be so nice.
lakos was one of the primary drivers of this
It's always bothered me that the only such feature in many languages is exception handlers (I'm also bothereed by functions that throw things).
I want "late" bindings, implemented as "shallow" bindings. "Late" as in binding is established at runtime in the call chain. "Shallow" as in you don't need to crawl the call chain to find it. Something like
extern Allocater *theAllocater = &DefaultAllocater;
...
// allocater scope
{ Allocater *prev = theAllocater;
theAllocater = NewAllocater();
...
theAllocater->free();
theAllocater = prev;
}
with a deep call using the current allocater // deep call
{ tmp = theAllocater->alloc(size);
...
}In hindsight, it would be pretty funny if "hey can you rewrite this game in Rust" is sufficient instructions to end up with memory-efficient code. In fact it would be pretty funny if it were enough to get this thing written in Rust, for all the specific details of what you actually mean when you say "this game"
Traditional where allocations matters, like for embedded devices you would use no-std.
An alternative standard library with a different focus is entirely possible.
Or as a middle ground a lint flagging allocations.
As an aside I believe the last ‘expect’ issue to triggers an existing clippy lint.