by rumanator · 6y ago · 0 comments
The only issue I have with C is that there are no good reasons for some of those missing features to be missing.
Take, for example, namespaces. Would it be a problem to implement them as, say, implicit prefixes?
Me I want range types like Ada. Real array types. I think I want blocks/coroutines.
aka CDC
#include <string.h>
__prefix__ str; /* in scope: "","str" */
strlen("Hi!"); /* try "strlen",done,ignore "strstrlen" */
len("Bye"); /* no "len",try "strlen",done */
__prefix__(foo_) { void bar(void); } /* "foo_bar" */Namespaces don't need to be mangled at all if they are interpreted as symbol prefixes.
I'd prefer that, say, namespace foo::bar resolved into foo_bar for all symbols (even that meant risking namespace naming collisions) to not having any support for namespaces in C.
In fact, this approach is already used to implement pseudo-namespaces, so that wouldn't be much of a stretch.