Speculative: Rust for base system components
Igor Mozolevsky
igor at hybrid-lab.co.uk
Sun Jan 6 13:57:50 UTC 2019
On Sun, 6 Jan 2019 at 13:50, Pratyush Yadav wrote:
> When I allocate a C object, I think about its lifecycle first,
> when/how it is allocated, when/how freed. Works pretty well for me and
> helps avoid memory leaks in most cases. But, one time out of a
> hundred, I might forget a free(). Bugs like these often don't stem
> from ineptitude IMHO, but from honest mistakes. Languages that make
> your job easier by taking care of these common pitfalls are not so
> bad.
That's because you simply engage your hands before engaging your
brain, and that's exactly what I meant by _d_i_s_c_i_p_l_i_n_e_! Write
documentation *first* then write the accompanying code, not the other
way around. or skip the documentation step altogether---how is the
reader of your code supposed to know that what you've written in code
is what you _i_n_t_e_n_d_e_d_ in the first place? What you've just
demonstrated there is astoninigly *poor* discipline!
> Another thing is, if the language takes care of memory allocation,
> synchronization, etc, I don't have to spend time and effort thinking
> about them, making sure everything is correct. I can spend that effort
> somewhere more useful, increasing my productivity.
What you're wanting is something to compensate for your lack of
discipline... Well there's an answer for that for C: lint/static
analysis.
--
Igor M.
More information about the freebsd-hackers
mailing list