Misc

C++ Compatibility / Interoperability

Cilia is compatible to C++ and maybe other languages of this “language family” / “ecosystem”,
as with:

Bi-directional interoperability, so (with a hypothetical C++/Cilia compiler) it is possible to include

Can call C functions, access C structs (as C++ can do).

The compiler recognizes the language (C, C++, or Cilia) by:

When translating C++ code to Cilia then change conflicting names, e.g.

Two-Pass Compiler

So no forward declarations necessary, as with C# and Java (but unlike C/C++, due to its single-pass compiler).

Restricted Mixed Arithmetic

No mixing of signed with unsigned integer:

Mixing integer with float:

Endianness

Having integers with a defined endianness is mainly useful for binary file and network message formats, which typically follow specific (often traditional) conventions.

When integers are read and written in the processor’s native endianness, there is no overhead at all. Handling the non-native endianness merely involves shuffling bytes at read and write time, with no impact on the actual calculations.

Big Endian (Motorola)

Little Endian (Intel)

Extended & Arbitrary Precision Integer & Float

Integer Operations with Carry

I want integer operations with carry (flag or UInt) to implement Int128, Int256 etc. without the need for processor specific assembler or compiler intrinsics.

Saturation Arithmetic

cilia::saturating::Int behaves like cilia::Int, but applies saturation to all operations. Values are clamped to their minimum and maximum limits instead of wrapping around. This is typically implemented using SIMD, as many media/DSP instruction sets provide native support for saturation.
See https://en.wikipedia.org/wiki/Saturation_arithmetic

Reserved Keywords

Reserved keywords for future use (maybe, maybe not).

Cilia Versioning

Versioning of the Cilia source code

Macros

No function-like macros, just basics like:

Optionals

String? name = ...
translates to
Optional<String> name = ...

Optional Member Access

Optional Chaining

Optional Pointers

Plain T* as well as T^, T+, T- can be used like an optional.

Int? len = pointerToWindow?.title()?.length()
translates to

Optional<String> __tmpTitle = pointerToWindow ?
  Optional((*pointerToWindow).title())
  :
  NullOpt

Optional<Int> len = __tmpTitle ?
  Optional((*__tmpTitle).length())
  :
  NullOpt

And while technically an Optional<T> is an object T plus a Bool hasValue, for pointers T* the Optional<T*> is just a pointer, as a pointer can be null in itself:

Therefore a T*?/Optional<T*> can be assigned to a plain T*, and you better use just that:

// Not this:
//T*? optionalPtrToContactInfo = user?.ptrToContactInfo
// But this:
T* ptrToContactInfo = user?.ptrToContactInfo

String realName = ptrToContactInfo?.name ?? ""

So in Cilia for a T*?/Optional<T*> that has a value, that value is never NullPtr. And when you assign NullPtr to a T*?/Optional<T*> optionalPtr, then optionalPtr.hasValue() returns false.
This is different than in C++, so for interop with C++ you may need to use std::optional<T*> or Optional<Optional<T*>>.

Anonymous Members

Anonymous Class Declarations

Late / Deferred Compiled Member Functions

For Compile Time Polymorphism, instead of CRTP (Curiously Recurring Template Pattern).