Re:Which language has the brightest future for replacing C: ...
by quotemstr on Wednesday November 11, 2015 @06:18AM
(#10546031)
> You're not supposed to use the stdlib for baremetal programming.
I don't think it's useful to partition the world into microcontrollers and "LOL, memory is finite?" domains. Allocations can fail for normal programs, particularly when imposing subsystem-specific allocation limits or when running in small, crowded address spaces (e.g., mobile devices). It's often useful to be able to recover from this condition without completely killing the process, since process death is much more annoying for users than a specific task failing. (Wouldn't you rather see a video not play than see your entire program die?)
Re:Which language has the brightest future for replacing C: ...
by kibwen on Wednesday November 11, 2015 @06:31AM
(#10546082)
Rust's libcore wasn't split out for "LOL, memory is finite" domains. It exists so that you can write Rust programs that restrict themselves to doing no dynamic allocation whatsoever, as needed for environments where an allocator simply isn't available or allowed.
Re:Which language has the brightest future for replacing C: ...
by quotemstr on Wednesday November 11, 2015 @06:37AM
(#10546103)
My point is that I want to write programs that do use dynamic allocation, but also handle failure of this dynamic allocation in a reasonable way. Right now, Rust's philosophy is that you can choose whether to use dynamic allocation, but if you do, it'd better be an infallible allocator.
> instead of trying to create something new
monadic error handling isn't new. It's an old feature used by many languages, and preferred by many over exceptions.