On Thu, Feb 14, 2013 at 10:49 PM, Brian Smith <bsm...@mozilla.com> wrote:
> For example, Rust can't, in general, stop you from writing "if (!x)" instead 
> of "if (x)" like I did in a recent NSS bug.

Depending on what 'x' is and how it was obtained it's possible it
could be stopped. If it's a null pointer check for example then in
Rust you'd be pattern matching on an option type and you wouldn't be
able to use 'x' in the '!x' portion without a compile error. Depending
on the evolution of Rust, if it's a boolean result that affects other
arguments related to where the result was obtained, the types of those
objects could be changed such that the code doesn't compile (dependent
types, typestate or in the absence of that API design similar to
Patrick Walton's 'Typestate is Dead' article). You're right about the
'in general' though. Sorry about the derail, but I'm generally
interested in how Rust-like languages can help avoid these types of
errors.

Chris.
-- 
http://www.bluishcoder.co.nz
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to