Getting Interested In Language Design… C++ 2.0 anyone? | Accidental Scientist

Getting Interested In Language Design… C++ 2.0 anyone?

One of the things I’ve noticed while programming is the number of times when I’ve found really annoying edge cases in the C++ language that I wish I could fix.

One example – its complete lack of support for tables.

I’d love to be able to define a list of things, with columns of a given type. Under the hood, the compiler would generate arrays for me from the rows of each of the columns.

Why?

Quite simply, the advantage is that there’s a bunch of coherency there that can be exploited. If you create several separate arrays, it’s hard to make sure that they’re all synched up. If the data is all in a single row, you have a hope of keeping it together. Not doing so is just asking for bugs.

Similarly, I’d like the ability to define a struct or class and be able to direct the compiler to split it up into several pieces. The “hot” data would end up in one chunk, the rest in another. Nice for cache coherency. Support for “banding” of structs would also be awesome. (Kind of like based-pointers from the old MSVC extension days).

Along the same lines, built in support for auto-generated serialization code would be freakin’ awesome. Especially if it could handle endianness, and also figure out for inherited classes the most efficient way to serialize the whole kit & caboodle wholesale.

These are all problems for which solutions exist today. Except they’re hacky, hokey and all-round pretty lame.

I may have to just settle for a code-gen solution on the front-end.

About Simon Cooke

Simon Cooke is a video game developer, ex-freelance journalist, screenwriter, film-maker and all-round good egg in Seattle, WA. The views posted on this blog are his and his alone, and have no relation to anything he's working on, his employer, or anything else and are not an official statement of any kind.
facebook comments
blog comments

One Response to Getting Interested In Language Design… C++ 2.0 anyone?

  1. Afriza N. Arief says:

    I don't get your points about having table over having an array (or vector) of struct.

    If you want to go and propose some improvements over C++, you might have a better luck discussing it with D programming language's designers

    The D Programming language has been featured several times in Google EngEDU as well..