tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.02k stars 48 forks source link

Why not const by default? #152

Open porky11 opened 7 years ago

porky11 commented 7 years ago

When declaring varialbes you normally don't declare it const, and it's normally never necessary. When variables have to be declared mutable explicitly errors may be found more easily. This wouldn't be as in C. Is it important, that the language is like C, even if some other design may be better?

porky11 commented 7 years ago

const by default could also be implemented by macros, but this may be difficult, becuase it's not clear, where we have types and where not, expecially for more complicated types like (array-of 2 int) (which should not expand to (const (array-of (const 2) (const int))) if they are not defined as mutable) or most concept-macro types

BitPuffin commented 7 years ago

I agree on this. Sounds better to me to have explicit mutability.