| ▲ | The feature in OxCaml that more languages should steal(theconsensus.dev) | ||||||||||||||||||||||
| 13 points by tosh 10 hours ago | 7 comments | |||||||||||||||||||||||
| ▲ | pjmlp 9 minutes ago | parent | next [-] | ||||||||||||||||||||||
Managed languages already had explicit stack allocation during the last century. Unfortunately we went crazy with heap only types, on the other hand thankfully the pendulum is turning around and most compiled languages are having them back. However nothing of this matters if you end up shipping the app inside Electron. | |||||||||||||||||||||||
| ▲ | Georgelemental 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
> In most languages (Java, Go, C#, Rust, Zig, OCaml, etc.) the process is reversed: you take a profiler to try and find allocations (usually in loops that happen millions of times). Then you go and eliminate or minimize the allocations. This isn't fully correct. In Zig, the common pattern is that any function which allocates accepts an explicit allocator parameter; if you don't pass one explicitly, you don't get any heap allocations. Rust doesn't make things quite that visible. But, if you restrict yourself to the standard library and crates designed with this in mind, allocations are usually not too hard to find. And you can always use `#![no_std]` without `alloc` if you want to be sure. Neither language is ever going to insert a heap allocation if it's not somewhere in the source. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | xg15 2 hours ago | parent | prev [-] | ||||||||||||||||||||||
Can we extend this to more properties, such as: Does IO, makes system calls, launches or interacts with threads, may block or has an unexpected space/time complexity? | |||||||||||||||||||||||
| |||||||||||||||||||||||