Skip to content

Core 0.1.6

Pre-release
Pre-release

Choose a tag to compare

@zweiler1 zweiler1 released this 09 Aug 19:09
· 1299 commits to main since this release
32fef82

Changelog

  • Added ability to compare variants to types to check if the variant holds data of that type
  • Added the force-unwrapping operator !(T) to variants
  • Added ability to force-unwrap tagged variants through !(VariantType.Tag) instead of !(T)
  • Added ability to pass non-variable expressions as references to functions, previously complex types needed to be passed through a variable
  • Added the variant extraction operator ?(T) to variants
  • Added ability to use the extraction operator with a tag instead of the type for tagged variants
  • Added ability to access the active_type field of any variant-typed variable
  • Added ability to compare variants with one another
  • Fixed all bugs preventing linked lists from working:
use Core.print

data IntList:
	i32 value;
	IntList? next;
	IntList(value, next);

def append(mut IntList list, i32 value):
	if list.next == none:
		list.next = IntList(value, none);
	else:
		append(list.next!, value);

def print_list(IntList list):
	print($"{list.value}");
	if list.next != none:
		print(" -> ");
		print_list(list.next!);
	else:
		print("\n");

def main():
	IntList list = IntList(10, none);
	print_list(list);
	append(list, 20);
	print_list(list);
  • Added ability for all optionals pointing to complex data to be used as "references" to that data (like Flint's version of pointers / references through the use of optionals)
  • Refactored all CreateStore and CreateLoad calls of LLVM to go through one custom API which ensures proper alignment of those instructions
  • Updated the main function to properly print all fields of the thrown error value (The type_id, value_id and message fields of the thrown error)
  • Added ability to inline-switch on error variables to reduce indentation level of error handling by one:
i32 result = some_call() catch:
    ErrArithmetic(e): print("is ErrArithmetic\n");
    anyerror(e): print("is anyerror\n");
  • Added ability to cast enum values to strings. The enum value MyEnum.VAL1 will result in the string "VAL1" after casting
  • Added ability to cast enum values to any integer type (i32, u32, i64, u64 and u8)
  • Refactored the build.sh script to enable using the number of cores used for compilation through the -j <num> flag
  • Fixed string interpolation bug where types were not resolved correctly within the string interpolation, making typecasts etc impossible to do explicitely, like $"val = {i32(float_value)}\n" for example
  • Fixed assignments of complex values like data on optional variables and fields
  • Fixed type creation of complex data holding itself within more complex types, like List holding a List? optional field for the next element
  • Fixed bug where optionals within other data as fields were handled as complex data instead of put into the complex data inline
  • Fixed bug where the value field of optionals was not properly handled as a complex structure but inlined leading to...interesting bugs
  • Fixed bug in the Lexer which was unable to parse two \" characters correctly inside string literals when they are placed right after each other
  • Fixed bug which prevented the Windows build from working with the new error to string-casting system because of the (incorrect) static relocation option, which prevented any globals / constants from working. As globals and constants now work properly, they will be refactored for the next release so that string literals are no longer stack-allocated but binary constants (like they should be). That missing feature was itching Me for months now, and I am happy that I have finally found the root cause of it (the static relocation setting)

Full Changelog: v0.1.5-core...v0.1.6-core