Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I can also say confidently that the #1 method to combat memory safety errors is array bounds checking. The #2 method is guaranteed initialization of variables. The #3 is stop doing pointer arithmetic (use arrays and ref's instead).

#4 safer union/enum, I do hope D gets tagged-union/pattern-matching sometimes in the future, I know about std.sumtype, but that's nowhere close to what Rust offer



Doing a sumtype is on the agenda and we'll get to it.

BTW, D has always had quite an advanced pattern matcher for types.

https://dlang.org/spec/expression.html#is_expression

https://dlang.org/spec/template.html#template_type_parameter...


Another language with such features, including sumtypes, is V (Vlang)[1].

[1] https://github.com/vlang/v/blob/master/doc/docs.md#sum-types




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: