Skip to content

v0.6.1 - Multi-Pointers & Multiple Ownership in constructor call

Compare
Choose a tag to compare
@aldrinmathew aldrinmathew released this 29 Nov 12:44
26d09ba
  • Fixed serious issue that the -static flag passed to clang for the LLVM IR to machine code compilation, always caused segfaults. The flag has been removed from the compilation command, and since static compilation is the default behaviour, this doesn't change anything
  • Added multi-pointers. They follow this syntax
#[+ cstring ?]    //  The + inside means that this is a multi-pointer
  • Multi pointers have the length/extent/bound of the pointer stored alongside it. This will be useful in bounds checking in the future.
  • Only multi pointers can now be indexed into. That is, of all pointer variants, only multi pointers supports indexing/subscript operator
  • Main function now calls module initialisers for all modules that have global variables having non-constant initial value
  • The syntax for main function has been updated so that the only argument used is a multi pointer with anonymous ownership is used for receiving the arguments, instead of having 2 arguments, one for the count and another for the pointer to the data
  • The concept of pointer access has been removed from ast::MemberAccess & ast::MemberFunctionCall. Previously, special syntax >- had to be used for accessing members & calling member functions on pointers of types. Now, the idea is that the pointer have to be dereferenced before doing any of those.
  • Improved conversion from str to cstring. Previously, if the string was a constant, an extra allocation was made, but now
  • heap'get now returns a multi pointer with heap ownership, if a count is provided. If not, a normal pointer with heap ownership is returned
  • heap'grow now always expects a multi pointer
  • The own syntax in constructor calls now supports owning multiple instances of data. The count has to be provided. The syntax is:
own[5] Hello from (a, b)