| ▲ | Animats a day ago | |
Classic mistakes in language design that have to be fixed later. - "We don't need any attributes", like "const" or "mut". This eventually gets retrofitted, as it was to C, but by then there is too much code without attributes in use. Defaulting to the less restrictive option gives trouble for decades. - "We don't need a Boolean type". Just use integers. This tends to give trouble if the language has either implicit conversion or type inference. Also, people write "|" instead of "||", and it almost works. C and Python both retrofitted "bool". When the retrofit comes, you find that programs have "True", "true", and "TRUE", all user-defined. Then there's the whole area around Null, Nil, nil, and Option. Does NULL == NULL? It doesn't in SQL. | ||
| ▲ | tadfisher a day ago | parent | next [-] | |
That's what's nice about coarse-grained feature options like Rust's editions or Haskell's "languages", you can opt in to better default behavior and retain compatibility with libraries coded to older standards. The "null vs null" problem is commonly described as a problem with the concept of "null" or optional values; I think of it as a problem with how the language represents "references", whether via pointers or some opaque higher-level concept. Hoare's billion-dollar mistake was disallowing references which are guaranteed to be non-null; i.e. ones that refer to a value which exists. | ||
| ▲ | Ferret7446 5 hours ago | parent | prev | next [-] | |
> Does NULL == NULL? It doesn't in SQL. That's because SQL null is semantically different. Most nulls are a concrete value (null pointer). SQL null is the relational null ("not known"). It's closer to NaN (but still different) | ||
| ▲ | dfawcus 12 hours ago | parent | prev [-] | |
Attribute (qualifier), or storage class? https://www.airs.com/blog/archives/428 The use of 'const' in C is very much a mixed blessing; I certainly have experience of the 'const poisoning' issue. Possibly it would have been better as a storage class. For bool, yes it was a useful addition. Especially for the cases where old code would have something like:
and that was then combined with logic expecting 'true' to be 1; which could sneak in over time. | ||