Re:Is your programming language unreasonable? (2015)
by lmm on Saturday October 10, 2020 @07:33AM
(#24738222)
At ABI level you might want to use all-bits-zero to represent something other than a valid instance of your type, sure; that's how Rust's option type works. But making your language semantics say that that has to be allowed everywhere a valid instance could be passed is a mistake; for most functions it's an error to call that function without passing valid argument values, so it's better if the language has a way of enforcing that rather than forcing you to write it out by hand every time.
[ Parent
| on HN ]
Re:Is your programming language unreasonable? (2015)
by rightbyte on Saturday October 10, 2020 @07:37AM
(#24738243)
Ye some "always valid kinda a pointer"-type is nice. I wish there was some standardized compiler support for that in C, like MS kinda silly empty macros in function signatures to annotate input and output pointers etc.