Remember, NAL shall be "transcodable" to C, therefore in this section, we show how things in NAL can be converted to C if removed or replaced.
->Compilers know the type of a value when transcoding to C and hence can automatically decide whether it is a pointer or not. No need to have two separate operators -> and . therefore. To make code look like other programming languages, we favor the dot operator.
short, long, int, signed, unsignedThe type int and its modifiers short and long are system dependent. Additionally, the modifiers signed and unsigned are just cumbersome. We replace this all with built-in types:
NAL:
i8
i16
i32
i64
...
C:
int8_t
int16_t
int32_t
int64_t
...
NAL:
u8
u16
u32
u64
...
C:
uint8_t
uint16_t
uint32_t
uint64_t
...
charIn C, the type char has the semantics of storing one character. That is usually 1 Byte but not necessary, therefore system dependent. Additionally, char is accessible as a number which is semantically wrong. We replace the type with the following.
NAL:
letter
C:
char
A letter is encoded in UTF-8. It is not accessible as a number, unless one uses converter methods like myLetter.ToASCIINum().
letter, how about glyph?float, double and long doubleWe replace the floating point types of C with the following:
NAL:
f32
f64
f128
C:
float
double
long double (if available as 128 bit)
And we allow for newer floating point types like f16 (which would correspond to the IEEE-754 half type) or f128 (which would correspond to the IEEE-754 quad type)
single and double was given but was quickly abandoned.++ and --After discussion, all ++ and -- operators shall be deleted. There is little to gain from it.
Original discussion:
There is a prefix and postfix variant of both ++ and --. The postfix variant has the semantics of changing the value AFTER its access. We do not allow for these variants anymore.
i += 1 is not hard to write or even i = i + 1.++ and -- is often used in C for the for loop. But as we change the for loop anyway, there is one less reason to have these operators._ as a symbol characterDiscarded.
Idea was to disallow the underscore _ as a character in symbol names. Was smiled at by a few but frowned upon my many and overal.
snake_case is debatably easier to read than camelCase.m_member would not be possible anymore.SCREAMING_SNAKE_CASE would not be possible anymore.lowerCamelCase and UpperCamelCase.do-whileReplace do-while with a new keyword until. Put condition before {} Block. This needs a new thinking bucause the condition is inverted. But it is more intuitive and corresponds more closely to the semantic such a loop represents.
NAL:
until(condition) {
...
}
C:
do {
...
} while (!condition)
do-while completely without replacement.dowhile loop but without inverted condition.until is used in other languages but just as an inversion of a normal while loop, so that might be a problem.,There is no need for a comma operator. Erase it without replacement.
for loop. But as we change the for loop anyway, there is one less reason to have these operators.union TypeThere really isn't that much of purpose in having a union type. Erase it without replacement.
There really isn't that much of purpose in having Bitfields. Erase it without replacement.
[]Ditch the declaration with [] as it induces the usage of pointer arithmetic. Define a built-in array type instead.
[] type evaluates to a pointer to the first element of an array. That has no purpose if we aren't allowing pointer arithmetics anymore.Pointer arithmetics are inherently unsafe. We need to get rid of it. The only real thing which needs to be replaced is the array type [] which can be replaced by a built-in type array.
++ and -- which we will ditch as well.for loop declarationThe general declaration of a for loop in C like for (init; condition; step) will be removed. Instead, for loops shall only be used for range based loops.
for loops.init, condition and step were often misused.goto statementThe goto statement has no more use. Remove it completely without replacement.
asm statementThe asm statement shall be removed completely without replacement.
asm.inline keywordThe inline keyword shall be removed completely without replacement.
register keywordThe register keyword shall be removed completely without replacement.
volatile keywordThe volatile keyword shall be removed completely without replacement.
static keywordThe static keyword shall be removed completely without replacement.
this parameters to distinguish between static and non-static members and all top level symbols with a dot . are automatically static.extern keywordThe extern keyword shall be removed completely without replacement.
Do not define multiple variables with commmas ,.
%=, >>=, <<=Ditch these three operators.
%= makes no sense mathematically.+= -= *= and /= are usefule and simplify programming. Leave them.&= |= and ^= are useful and simplify programming flags and bools. Leave them