4 ms·
I'd make const the default, requiring a var keyword for variables. This makes it easier to get const correctness right because a missing var would break compila
by opk 11y ago
I'd make const the default, requiring a var keyword for variables. This makes it easier to get const correctness right because a missing var would break compilation while currently, a missing const doesn't. Next on my list would be := for assignment which is less easy to confuse with equality followed by variable declarations being name: type which is better once type names get long - admittedly they never are in plain C.
- burfog 11y agoIt takes a lot more than that to get const correctness right. Consider the strstr function. The constness of the result really ought to match the constness of the first argument. It can get much worse. Consider a function that takes two strings as arguments, then returns the longer one. Constness of the result ideally depends on the input. At the very least, when both inputs have the same constness you'd expect the result to also have that constness.