What is your language feature wish list?
-
What languages, wishlists do you have for your favorite programming languages? C and where applicable, C++: preprocessor definitions that are private to the actual (in this case header) file they are contained in. namespaces that are private to their header. and/or a standard way to separate the implementation of templates into a cpp file a way to predeclare templates (not template instantiations) such that you can access them before they are defined. C#: Mainly I want its code generation to have DSL (domain specific language) capabilities. This means you can create code generation facilities that introduce new keywords into the language, for doing things like AOP and cross-cutting functionality orthogonal to any specific class. The only problem with it is I think it would be overused.
To err is human. Fortune favors the monsters.
-
What languages, wishlists do you have for your favorite programming languages? C and where applicable, C++: preprocessor definitions that are private to the actual (in this case header) file they are contained in. namespaces that are private to their header. and/or a standard way to separate the implementation of templates into a cpp file a way to predeclare templates (not template instantiations) such that you can access them before they are defined. C#: Mainly I want its code generation to have DSL (domain specific language) capabilities. This means you can create code generation facilities that introduce new keywords into the language, for doing things like AOP and cross-cutting functionality orthogonal to any specific class. The only problem with it is I think it would be overused.
To err is human. Fortune favors the monsters.
C: - A standard (and simple) way to declare a parameter (or local variable) as not-nullable. Clang supports such an extension, as does gcc (but in a less clean way). It would be better to have a portable tag to do it defined in the language standards. Honestly, this should have been done in back in C99, and would have probably stopped many bugs over the last decade or two. - Variable value bound declarations. So if a parameter is declared
unsigned int
, but really only has a meaningful range of0-100
, it could flag it during compile time that it is an error. Probably more useful to set reasonable bounds on items which could cause integer overflows (or static buffer overflows when still used due to legacy code).. For example:typedef struct
{
int id;
char name[20];
} myrecord_t;myrecord_t * alloc_list(__bound__(0, 10000000) unsigned int size)
{
/* size > 178956970 on 32-bit ===> overflow */
return malloc(size * sizeof(myrecord_t));
}void safecaller(__bound__(1, 100000) unsigned int size)
{
/* Okay - [1-1000000] with-in [0, 10000000] bounds */
myrecord_t * list = alloc_list(size);/* ... */
}void badcaller(unsigned int size)
{
/* Compile ERROR - default (32-bit) unsigned int not with-in [0, 10000000] bounds */
myrecord_t * list = alloc_list(size);/* ... */
}