Hacker News
It's all about the allocator
yeureka
|next
[-]
ibobev
|root
|parent
|next
[-]
yeureka
|root
|parent
|next
[-]
whorleater
|root
|parent
|previous
[-]
lakos was one of the primary drivers of this
Panzerschrek
|next
|previous
[-]
Chromium-based applications consume so much memory, not because they don't use manual memory management, but because JS used for application code isn't nearly as efficient in memory usage as any other proper language. Also the browser engine itself is optimized in such a way, that it sacrifices memory usage to gain more speed.
KolmogorovComp
|next
|previous
[-]
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.
krukah
|next
|previous
[-]
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.
fwlr
|next
|previous
[-]
mac3n
|root
|parent
|next
[-]
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);
...
}
nagaiaida
|root
|parent
|next
|previous
[-]
i have some generic command dispatch stuff that handles sudo/doas or other similar cli prefix wrapper utilities by just passing that info all the way down to the eventual external proc invocation as a dynamic variable (and actually it wouldn't even let me get away with sticking it all into the signatures because of potential argument conflicts in the general case). that way everything external this tool dispatches to can be defined as if run unprivileged for concision/flexibility but you still never need to invoke the tool itself with root privileges to sneak a sudo in for the eventual command because there's a mechanism for indicating desired privilege escalation that can quietly ripple out to everywhere it's needed without cluttering already complex signatures even more.
personally i find dynamic scoping immensely useful specifically in conjunction with exception handling: it can help you turn resumable exceptions into exceptions that return values to the thrown context in just a couple lines for e.g. an incredibly lightweight effect handling implementation or whatever you wanna do with that.
that said, without something readily visually distinguishing like raku's explicit twigils indicating a dynamic variable or something like clojure's conventional earmuffs on names to indicate the same, i do get why it's often seen as more trouble than it's worth by those less used to it.
ngriffiths
|next
|previous
[-]
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"