Month April 2023

Module file structure

Module source file contains three parts (order matters): Dependencies In this example moduleA is used without name imports, thus all names of that module can be referred using long names: moduleA_functionfromModuleA For example: sys_getParent. While moduleB is used with imports.…

Formal grammar

General program structure Argentum program consists on modules. All module sources are placed in the same directory in text files having “.ag” extension. File name matches module name. One module is passed to the compiler as starting module name. Compiler…

Shared pointers to immutable objects

Personally I find the very conception of immutable variables very oxymoronic and illogical. When “immutable variable” is a field, it doesn’t work as immutable in some cases: at least in constructors and in deserialization logic. It prevents objects from delegating…

General info about types

Type deduction for fields, lambda parameters, results, local variables and constants Every value in Argentum has statically assigned type. For fields, constants, variables and lambda prototypes compiler deduces their types automatically by their initial values: Explicit type declarations: Only function/method…

Pointer types

In contrast with C++ or Rust Argentum pointers always point to class instance or interface instance. They cannot point to local variables or object fields. This is much like references in Java In contrast with Java and other GC-based languages…

Primitive types

Argentum has very few primitive types: Argentum allows to work with 8-bit, 16-bit, 32-bit, 64-bit types in a raw data structures with the help of sys_Blob class. This is mostly useful for interop with C or other languages. When declaring…

Argentum got const-ness and shared ownership

Tl;DR Added two pointers “*Class”, “&*Class”, one operator “*expression”, one type of constant “*methods”. What’s added: How to use Sometimes it is good to have immutable data objects. This is how it’s done in Java: This is how it’s implemented…

Tutorial #0 Basic syntax

The sources of argentum programming language are organized in modules.Modules are text files with extension ag residing in the same directory. They are always in UTF-8 encoding. On compiler invocation one of modules is passed to it as a starting…

Names and modules handling

Starting today Argentum got new rules for modules and name visibility. TL;DR Previously: Now: Examples All examples can be found in windows-demo #1 Basics #2 Friend of my friend… The SDL-FFI module contains the low-level function declarations implemented in C:…