3 ms·
>> In design - not just programming language design - constraints are generally a good thing. The best example of that in programming language design I have se
by smlckz 6y ago
>> In design - not just programming language design - constraints are generally a good thing.
The best example of that in programming language design I have seen is the V programming language. (https://vlang.io https://vlang.io)
No global variables, no null/undefined/nil/None/...
V is the only language I know in which variable shadowing is an error.
(Do you know any other language with this feature/constraint?)
And then I remember the handling of ''var''s in js and hoisting etc. ... sigh!
- kazinator 6y ago> Do you know any other language with this feature/constraint gcc -Werror=shadow Demo: $ gcc -Werror=shadow -x c - void foo(int x) { { int x; } } [Ctrl-D][Enter] <stdin>: In function ‘foo’: <stdin>:1:25: error: declaration of ‘x’ shadows a parameter [-Werror=shadow] <stdin>:1:14: note: shadowed declaration is here cc1: some warnings being treated as errors
- smlckz 6y agoAh! Good old C. I did not dare to open the gcc man page, now I think I will look at it. For that constraint, one have to pass an option. I want to know if any language (other than V) which has this as default.