Date: Sun, 6 Jan 2019 13:57:11 +0000 From: Igor Mozolevsky <igor@hybrid-lab.co.uk> To: Pratyush Yadav <me@yadavpratyush.com> Cc: Hackers freeBSD <freebsd-hackers@freebsd.org> Subject: Re: Speculative: Rust for base system components Message-ID: <CADWvR2hFU4nYbABL1rYrMAZ1s0ea9F0JTyZqqNfi6C7_JfGXNw@mail.gmail.com> In-Reply-To: <CA%2BX=3TJeNhgLZnpqqrrYPwxw4mcXFyaY8w%2BMqde2rt2s3pDCAg@mail.gmail.com> References: <201901021829.x02IT4Kc064169@slippy.cwsent.com> <e954a12f-5d23-7a3f-c29b-c93e1250965c@metricspace.net> <361CCB81-AEB6-4EAC-9604-CD8F4C63948C@gmail.com> <CADWvR2ju7y_rcY3MFe_381yBmPXgm1BA7RzA9ZTUfTtCHdFGLw@mail.gmail.com> <6DF138FB-E730-477A-A992-8FE1944DDE94@exonetric.com> <CADWvR2hETR3j2=aNVGDiYfJeyeqgavDQOuxkxrE%2BVZFfD5BzJg@mail.gmail.com> <451787DE-0659-4F7D-B011-904F90866DDB@gmail.com> <CADWvR2ij6rHw-KS6Qm9xMAmJzCCvcpgQ1LHQrGknhiaGep6V1Q@mail.gmail.com> <H7D1D6fUMtF9-2LbnJrYEFnDraYBSD1a0DAK-Wn4UFj9PlkNZXcB5rwWcJ02PqW9vlv0u-wiGjq8JvcqmfczsHD1HxvhXQoLZY52s7EgjW0=@sidju.se> <CADWvR2jJ%2BujN_Sm0EfEx1AfHm88-Dvn2mRMS1=RS-Zwt1L6DKw@mail.gmail.com> <CA%2BX=3TJeNhgLZnpqqrrYPwxw4mcXFyaY8w%2BMqde2rt2s3pDCAg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADWvR2hFU4nYbABL1rYrMAZ1s0ea9F0JTyZqqNfi6C7_JfGXNw>