News for hackers. Stuff that matters.
Re:Custom Allocators in Rust by foota on Saturday April 08, 2023 @02:40PM (#35496278)
There's been some side work towards defining dynamic scoping for rust. E.g., allow functions to declare a dependency on some value or type, and then require callers to either pass that dependency explicitly, or have it on their dependencies.

One of the proposed uses was for allocators.

https://tmandry.gitlab.io/blog/posts/2021-12-21-context-capa... is one of the more cogent proposals.

I don't think any of these has made substantial progreess towards being approved though.

Re:Custom Allocators in Rust by forrestthewoods on Saturday April 08, 2023 @05:54PM (#35498027)
That’s pretty neat. Seems very similar to Jai’s implicit context. I’m definitely a fan of context objects. It solves so many painful problems related to allocators, logging, etc.
Re:Custom Allocators in Rust by foota on Sunday April 09, 2023 @04:04AM (#35500811)
Yeah, I think this is a really nice thing to have in a language, purists may not like it, but being able to flexibly pass something through layers is a cheat code for coding.