Month August 2023

Nested Optionals, `&&`, `||`

In Argentum optional type can wrap any type, including another Optional. This theoretically allows having types like ?int, ??int, ???int, and so on. Why is this needed? For instance, when accessing a container of bool or optional elements, it’s necessary…

Optional and Containers Indexes/Keys

In Argentum all standard containers, return optionals (?T) when indexed with x[i]. Therefore, Argentum makes it impossible to access beyond the array bounds or using an invalid key in associative containers. It not only helps to prevent OOB errors. It…

Optionals and Weak References

In Argentum, associative reference (also known as weak) is one of fundamental built-in types. Such reference is easily created, copied, passed, and stored. It is not a pointer, it is rather a Schrodinger box that may or may not have…

Argentum optionals and Type Casting

In Argentum typecast operator has syntax: expression ~ ClassOrInterface. It performs two types of type castings. Unlike casts in Java and C++, where it is not required to check the typecast result, in Argentum, it is syntactically impossible to access…

There are no null pointers in Argentum

TLDR; in Argentum there is no separate nullable, bool and optional types. It’s the same concept, thus all operations, guaranties and safety measures are uniformly and seamlessly applicable all of them. Nowadays, it has become fashionable to add Null safety to all programming languages. In Argentum,…

There is no “bool” in Argentum

What values can hold optional<T>? It’s either the value T itself or a special value “nothing” that doesn’t match any values of T . Now let’s try a trick: what is optional<void>? It’s a single-bit value that distinguishes between “nothing”…

Argentum has no statements, only expressions

In Argentum, there is an operator {A; B; C}, which executes A, B, and C sequentially, returning the result of C. Blocks can group multiple expressions: Blocks allow local variables: Blocks can appear in any expressions, for example in a variable initializer. Note the absence of…