<-- back

Things to throw away or replace

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.

Arrow operator ->

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.

Discussion

short, long, int, signed, unsigned

The 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 ...

char

In 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().

Discussion

float, double and long double

We 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)

Discussion

Operators ++ 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.

Discussion

Underscore _ as a symbol character

Discarded.

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.

Discussion

do-while

Replace 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)

Discussion

Comma operator ,

There is no need for a comma operator. Erase it without replacement.

Discussion

union Type

There really isn't that much of purpose in having a union type. Erase it without replacement.

Discussion

Bitfields

There really isn't that much of purpose in having Bitfields. Erase it without replacement.

Discussion

Array type []

Ditch the declaration with [] as it induces the usage of pointer arithmetic. Define a built-in array type instead.

Discussion

Pointer arithmetics

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.

Discussion

General for loop declaration

The 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.

Discussion

goto statement

The goto statement has no more use. Remove it completely without replacement.

Discussion

asm statement

The asm statement shall be removed completely without replacement.

Discussion

inline keyword

The inline keyword shall be removed completely without replacement.

Discussion

register keyword

The register keyword shall be removed completely without replacement.

Discussion

volatile keyword

The volatile keyword shall be removed completely without replacement.

Discussion

static keyword

The static keyword shall be removed completely without replacement.

Discussion

extern keyword

The extern keyword shall be removed completely without replacement.

Discussion

Multiple variable declaration with comma

Do not define multiple variables with commmas ,.

Discussion

Operators %=, >>=, <<=

Ditch these three operators.

Discussion