Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: c3lang/c3c

latest-prerelease-20251025-2053

25 Oct 20:53

Choose a tag to compare

Pre-release
latest-prerelease-tag

Allow `(Foo)0` bitstruct casts even if type sizes do not match.

Version 0.7.6

03 Oct 19:00

Choose a tag to compare

0.7.6 Change list

Changes / improvements

  • Add lengthof() compile time function #2439
  • Allow doc comments on individual struct members, faultdefs and enum values #2427.
  • $alignof, $offsetof and $nameof can now be used in $defined.
  • Infer generic parameters lhs -> rhs: List{int} x = list::NOHEAP.
  • Unify generic and regular module namespace.
  • env::PROJECT_VERSION now returns the version in project.json.
  • Comparing slices and arrays of user-defined types that implement == operator now works #2486.
  • Add 'loop-vectorize', 'slp-vectorize', 'unroll-loops' and 'merge-functions' optimization flags #2491.
  • Add exec timings to -vv output #2490.
  • Support #! as a comment on the first line only.
  • Add +++= operator.

Fixes

  • Compiler assert with var x @noinit = 0 #2452
  • Confusing error message when type has [] overloaded but not []= #2453
  • $defined(x[0] = val) causes an error instead of returning false when a type does not have []= defined #2454
  • Returning pointer to index of slice stored in a struct from method taking self incorrectly detected as returning pointer to local variable #2455.
  • Inlining location when accessing #foo symbols.
  • Improve inlined-at when checking generic code.
  • Fix codegen bug in expressions like foo(x()) ?? io::EOF? causing irregular crashes.
  • Correctly silence "unsupported architecture" warning with --quiet #2465
  • Overloading &[] should be enough for foreach. #2466
  • Any register allowed in X86_64 inline asm address. #2463
  • int val = some_int + some_distinct_inline_int errors that int cannot be cast to DistinctInt #2468
  • Compiler hang with unaligned load-store pair. #2470
  • ?? with void results on both sides cause a compiler crash #2472.
  • Stack object size limit error on a static object. #2476
  • Compiler segfault when modifying variable using an inline assembly block inside defer #2450.
  • Compile time switch over type would not correctly compare function pointer types.
  • Regression: Compiler segfault when assigning struct literal with too few members #2483
  • Fix compile time format check when the formatting string is a constant slice.
  • Compiler segfault for invalid e-mails in project.json. #2488
  • Taking .ordinal from an enum passed by pointer and then taking the address of this result would return the enum, not int.
  • Alias and distinct types didn't check the underlying type wasn't compile time or optional.
  • Incorrect nameof on nested struct names. #2492
  • Issue not correctly aborting compilation on recursive generics.
  • Crash during codegen when taking the typeid of an empty enum with associated values.
  • Assert when the binary doesn't get created and --run-once is used. #2502
  • Prevent foo.bar = {} when bar is a flexible array member. #2497
  • Fix several issues relating to multi-level inference like int[*][*] #2505
  • $for int $a = 1; $a < 2; $a++ would not parse.
  • Fix lambda-in-macro visibility, where lambdas would sometimes not correctly link if used through a macro.
  • Dead code analysis with labelled if did not work properly.
  • Compiler segfault when splatting variable that does not exist in untyped vaarg macro #2509

Stdlib changes

  • Added Advanced Encryption Standard (AES) algorithm (ECB, CTR, CBC modes) in std::crypto::aes.
  • Added generic InterfaceList to store a list of values that implement a specific interface
  • Added path::home_directory, path::documents_directory, path::videos_directory, path::pictures_directory, path::desktop_directory, path::screenshots_directory,
    path::public_share_directory, path::templates_directory, path::saved_games_directory, path::music_directory, path::downloads_directory.
  • Add LinkedList array_view to support [] and foreach/foreach_r. #2438
  • Make LinkedList printable and add == operator. #2438
  • CVaList support on MacOS aarch64, SysV ABI x64.
  • Add io::skip and io::read_le and io::write_le family of functions.

Version 0.7.5

05 Sep 18:53

Choose a tag to compare

Changes / improvements

  • Support alias foo = module std::io module aliasing.
  • Add compile-time @intlog2 macro to math.
  • Add compile-time @clz builtin. #2367
  • Add bitsizeof macro builtins. #2376
  • Add compile-time @min and @max builtins. #2378
  • Deprecate @compact use for comparison. Old behaviour is enabled using --use-old-compact-eq.
  • Switch available for types implementing @operator(==).
  • Type.is_eq is now true for types with == overload.
  • Methods ignore visibility settings.
  • Allow inout etc on untyped macro parameters even if they are not pointers.
  • Deprecate add_array in favour of push_all on lists.
  • Fix max module name to 31 chars and the entire module path to 63 characters.
  • Improve error message for missing $endif.
  • foo[x][y] = b now interpreted as (*&foo[x])[y] = b which allows overloads to do chained [] accesses.
  • Error if a stack allocated variable is too big (configurable with --max-stack-object-size).
  • Add @safeinfer to allow var to be used locally.
  • Types converts to typeid implicitly.
  • Allow $defined take declarations: $defined(int x = y)
  • Struct and typedef subtypes inherit dynamic functions.
  • Improved directory creation error messages in project and library creation commands.
  • @assignable_to is deprecated in favour of $define
  • Add linklib-dir to c3l-libraries to place their linked libraries in. Defaults to linked-libs
  • If the os-arch linked library doesn't exist, try with os for c3l libs.
  • A file with an inferred module may not contain additional other modules.
  • Update error message for missing body after if/for/etc #2289.
  • @is_const is deprecated in favour of directly using $defined.
  • @is_lvalue(#value) is deprecated in favour of directly using $defined.
  • Added $kindof compile time function.
  • Deprecated @typekind macro in favour of $kindof.
  • Deprecated @typeis macro in favour of $typeof(#foo) == int.
  • $defined(#hash) will not check the internal expression, just that #hash exists. Use $defined((void)#hash) for the old behaviour.
  • Added optional macro arguments using macro foo(int x = ...) which can be checked using $defined(x).
  • Add compile time ternary $val ??? <expr> : <expr>.

Fixes

  • List.remove_at would incorrectly trigger ASAN.
  • With avx512, passing a 512 bit vector in a union would be lowered incorrectly, causing an assert. #2362
  • Codegen error in if (try x = (true ? io::EOF? : 1)), i.e. using if-try with a known Empty.
  • Codegen error in if (try x = (false ? io::EOF? : 1)), i.e. using if-try with a CT known value.
  • Reduce allocated Vmem for the compiler on 32 bit machines.
  • Bug causing a compiler error when parsing a broken lambda inside of an expression.
  • Fixed: regression in comments for @deprecated and @pure.
  • Detect recursive creation of generics #2366.
  • Compiler assertion when defining a function with return type untyped_list #2368.
  • Compiler assert when using generic parameters list without any parameters. #2369
  • Parsing difference between "0x00." and "0X00." literals #2371
  • Fixed bug generating $c += 1 when $c was derived from a pointer but behind a cast.
  • Compiler segfault when using bitwise not on number literal cast to bitstruct #2373.
  • Formatter did not properly handle "null" for any, and null for empty faults. #2375
  • Bitstructs no longer overloadable with bitops. #2374
  • types::has_equals fails with assert for bitstructs #2377
  • Fix native_cpus functionality for OpenBSD systems. #2387
  • Assert triggered when trying to slice a struct.
  • Improve codegen for stack allocated large non-zero arrays.
  • Implement a5hash in the compiler for compile-time $$str_hash to match String.hash().
  • Functions being tested for overload are now always checked before test.
  • Compile time indexing at compile time in a $typeof was no considered compile time.
  • Slicing a constant array with designated initialization would not update the indexes.
  • Fix for bug when @format encountered * in some cases.
  • Compiler segfault on global slice initialization with null[:0] #2404.
  • Use correct allocator in replace.
  • Regression: 1 character module names would create an error.
  • Compiler segfault with struct containing list of structs with an inline member #2416
  • Occasionally when using macro method extensions on built-in types, the liveness checker would try to process them. #2398
  • Miscompilation of do-while when the while starts with a branch #2394.
  • Compiler assert when calling unassigned CT functions #2418.
  • Fixed crash in header generation when exporting functions with const enums (#2384).
  • Fix incorrect panic message when slicing with negative size.
  • Incorrect type checking when &[] and [] return optional values.
  • Failed to find subscript overloading on optional values.
  • Socket.get_option didn't properly call getsockopt, and getsockopt had an invalid signature.
  • Taking the address of a label would cause a crash. #2430
  • @tag was not allowed to repeat.
  • Lambdas on the top level were not exported by default. #2428
  • has_tagof on tagged lambdas returns false #2432
  • Properly add "inlined at" for generic instantiation errors #2382.
  • Inlining a const as an lvalue would take the wrong path and corrupt the expression node.
  • Grabbing (missing) methods on function pointers would cause crash #2434.
  • Fix alignment on jump table.
  • Fix correct ? after optional function name when reporting type errors.
  • Make log and exp no-strip.
  • @test/@benchmark on module would attach to interface and regular methods.
  • Deprecated @select in favor of ???.
  • Enum inference, like Foo x = $eval("A"), now works correctly for $eval.
  • Fix regression where files were added more than once. #2442
  • Disambiguate types when they have the same name and need cast between each other.
  • Compiler module-scope pointer to slice with offset, causes assert. #2446
  • Compiler hangs on == overload if other is generic #2443
  • Fix missing end of line when encountering errors in project creation.
  • Const enum methods are not being recognized. #2445
  • $defined returns an error when assigning a struct initializer with an incorrect type #2449

Stdlib changes

  • Add == to Pair, Triple and TzDateTime. Add print to Pair and Triple.
  • Add OpenBSD to env::INET_DEVICES and add required socket constants.
  • Added FileMmap to manage memory mapped files.
  • Add vm::mmap_file to memory map a file.
  • Updated hash functions in default hash methods.
  • Added FixedBlockPool which is a memory pool for fixed size blocks.
  • Added the experimental std::core::log for logging.
  • Added array @zip and @zip_into macros. #2370
  • Updated termios bindings to use bitstructs and fixed some constants with incorrect values #2372
  • Add Freestanding OS types to runtime env:: booleans.
  • Added libloaderapi to std::os::win32.
  • Added HashSet.values and String.contains_char #2386
  • Added &[] overload to HashMap.
  • Deprecated PollSubscribes and PollEvents in favour of PollSubscribe and PollEvent and made them const enums.
  • Added AsciiCharset for matching ascii characters quickly.
  • Added String.trim_charset.
  • Added array @reduce, @filter, @any, @all, @sum, @product, and @indices_of macros.
  • String.bformat has reduced overhead.
  • Supplemental roundeven has a normal implementation.

Version 0.7.4

02 Aug 13:16

Choose a tag to compare

Changes / improvements

  • Added const enums: enum Foo : const. Behaves like C enums but may be any type.
  • Casting to / from an enum is now possible again. No need to use .ordinal and .from_ordinal.
  • Inline associated enum values are deprecated, use --use-old-enums to re-enable them.
  • $typeof may return a compile time type.
  • Improved error messages on missing qualifier on enum value. #2260
  • Add --echo-prefix to edit the prefix with $echo statements. Supports {FILE} and {LINE}
  • Catch accidental foo == BAR; where foo = BAR; was most likely intended. #2274
  • Improve error message when doing a rethrow in a function that doesn't return an optional.
  • Add --list-asm to view all supported asm instructions.
  • Formatting option "%h" now supports pointers.
  • Improve error on unsigned implicit conversion to signed.
  • Update error message for struct initialization #2286
  • Add SipHash family of keyed PRFs. #2287
  • $is_const is deprecated in favour of @is_const based on $defined.
  • Multiline contract comments #2113
  • Removed the use of temp allocator in backtrace printing.
  • env::AUTHORS and env::AUTHOR_EMAILS added.
  • Suppress codegen of panic printing with when panic messages are set to "off".
  • Implicit linking of libc math when libc math functions are used.
  • Allow even smaller memory limits.
  • Check unaligned array access.
  • Add "@structlike" for typedefs.
  • "poison" the current function early when a declaration can't be correctly resolved.
  • Add komihash, a5hash, metrohash64, metrohash128, and wyhash2 variants with tests/benchmark. #2293
  • '$assignable' is deprecated.
  • Deprecate allocator::heap() and allocator::temp()
  • Add thread::fence providing a thread fence.
  • Place output in out by default for projects. Use temp folder for building at the command line.
  • Allow absolute paths for $embed.
  • Add @try and @try_catch.
  • Assignment evaluation order now right->left, following C++17 and possibly C23.

Fixes

  • mkdir/rmdir would not work properly with substring paths on non-windows platforms.
  • Hex string formatter check incorrectly rejected slices.
  • Correctly reject interface methods type and ptr.
  • Comparing a null ZString with a non-null ZString would crash.
  • Switch case with const non-int / enum would be treated as ints and crash. #2263
  • Missing bounds check on upper bound with const ranges foo[1:3].
  • Check up the hierarchy when considering if an interface cast is valid #2267.
  • Fix issue with labelled break inside of a $switch.
  • Non-const macros may not return untyped lists.
  • $for ct-state not properly popped.
  • Inline r / complex for complex numbers fixed.
  • Const slice lengths were not always detected as constant.
  • Const slice indexing was not bounds checked.
  • Initialize pool correctly in print_backtrace.
  • --max-mem now works correctly again.
  • Casting a fault to a pointer would trigger an assert.
  • Make to_float more tolerant to spaces.
  • Fixes to thread local pointer handling.
  • Fixes to JSON parsing and Object.
  • Array indices are now using int64 internally.
  • Bit shift operation fails with inline uint enum despite matching underlying type #2279.
  • Fix to codegen when using a bitstruct constant defined using a cast with an operator #2248.
  • Function pointers are now compile time constants.
  • Splat 8 arguments can sometimes cause incorrect behaviour in the compiler. #2283
  • Correctly poison the analysis after a failed $assert or $error. #2284
  • $foo variables could be assigned non-compile time values.
  • $foo[0] = ... was incorrectly requiring that the assigned values were compile time constants.
  • "Inlined at" would sometimes show the current location.
  • Fixed bug splatting constants into constants.
  • Resize bug when resizing memory down in ArenaAllocator, DynamicArenaAllocator, BackedArenaAllocator.
  • Error message for missing arg incorrect for methods with zero args #2296.
  • Fix stringify of $vaexpr #2301.
  • Segfault when failing to cast subexpression to 'isz' in pointer subtraction #2305.
  • Fix unexpected display of macro definition when passing a poisoned expression #2305.
  • @links on macros would not be added to calling functions.
  • Fix Formatter.print returning incorrect size.
  • A distinct type based on an array would yield .len == 0
  • Overloading addition with a pointer would not work.
  • Copying const enums and regular enums incorrect #2313.
  • Regression: Chaining an optional together with contracts could in some cases lose the optional.
  • char[*] b = *(char[*]*)&a; would crash the compiler if a was a slice. #2320
  • Implicitly cast const int expressions would sometimes not be detected as compile time const.
  • Using @NoReturn in a short body macro would not work properly #2326.
  • Bug when reporting error in a macro return would crash the compiler #2326.
  • Short body return expression would not have the correct span.
  • Fix issue where recursively creating a dir would be incorrectly marked as a failure the first time.
  • @format did not work correctly with macros #2341.
  • Crash when parsing recursive type declaration #2345.
  • Remove unnecessary "ret" in naked functions #2344.
  • Lambdas now properly follow its attributes #2346.
  • Not setting android-ndk resulted in a "set ndk-path" error.
  • Lambda deduplication would be incorrect when generated at the global scope.
  • Disallow accessing parameters in a naked function, as well as return, this fixes #1955.
  • Assigning string literal to char[<*>] stores pointer rather than characters. #2357

Stdlib changes

  • Improve contract for readline. #2280
  • Added Whirlpool hash.
  • Added Ed25519.
  • Added string::bformat.
  • Virtual memory library.
  • New virtual emory arena allocator.
  • Added WString.len.
  • Added @addr macro.
  • Add ConditionVariable.wait_until and ConditionVariable.wait_for
  • Added readline_to_stream that takes a stream.
  • Added Ref and RefCounted experimental functionality.
  • Added Volatile generic type.
  • Added UnalignedRef generic type.
  • Add String conversion functions snake_case -> PascalCase and vice versa.

Version 0.7.3

30 Jun 16:53

Choose a tag to compare

Changes since 0.7.2

Changes / improvements

  • $typefrom now also accepts a constant string, and so works like $evaltype.
  • $evaltype is deprecated in favour of $typefrom.
  • Literal rules have changed, this makes -0xFF now a signed integer.
  • Implicitly convert from constant typeid to Type in $Type assignment, and $assignable.
  • Make $Type parameters accept constant typeid values.
  • Deprecate foo.#bar.
  • Allow inference across && #2172.
  • Added support for custom file extensions in project.json targets.
  • $eval now also works with @foo, #foo, $Foo and $foo parameters #2114.
  • @sprintf macro (based on the $$sprintf builtin) allows compile time format strings #1874.
  • Improve error reports when encountering a broken "if-catch".
  • Add printf format to $assert and $error #2183.
  • Make accepting arguments for main a bit more liberal, accepting main(int argc, ZString* argv)
  • Make $echo and @sprintf correctly stringify compile time initializers and slices.
  • Add --sources build option to add additional files to compile. #2097
  • Support untyped second argument for operator overloading.
  • The form-feed character '\f' is no longer valid white space.
  • Show code that caused unreachable code #2207
  • Allow generics over distinct types #2216.
  • Support distrinct types as the base type of bitstructs. #2218
  • Add hash::sha512 module to stdlib. #2227
  • Compile time type assignment (eg $Foo = int) is no longer an expression.
  • Add @allow_deprecated attribute to functions to selectively allow deprecated declarations #2223.
  • Improve error message on pointer diff #2239.
  • Compile-time comparison of constant vectors. #1575.
  • $member.get supports bitstructs.
  • $member.set for setting members without the *& trick.
  • Initial support for #1925, does not affect C compilation yet, and doesn't try to link etc. Using "--emit-only"

Fixes

  • -2147483648, MIN literals work correctly.
  • Splatting const slices would not be const. #2185
  • Fixes to $define handling of binary ops.
  • Fixes methodsof to pick up all sorts of extension methods. #2192
  • --lsp sometimes does not emit end tag #2194.
  • Improve Android termux detection.
  • Update Android ABI.
  • Fixes to @format checking #2199.
  • Distinct versions of builtin types ignore @operator overloads #2204.
  • @operator macro using untyped parameter causes compiler segfault #2200.
  • Make unreachable() only panic in safe mode.
  • cflags additions for targets was not handed properly. #2209
  • $echo would suppress warning about unreachable code. #2205
  • Correctly format '%c' when given a width. #2199
  • Fix to is_array_or_slice_of_char #2214.
  • Method on array slice caused segfault #2211.
  • In some cases, the compiler would dereference a compile time null. #2215
  • Incorrect codegen if a macro ends with unreachable and is assigned to something. #2210
  • Fix error for named arguments-order with compile-time arguments #2212
  • Bug in AST copying would make operator overloading like += compile incorrectly #2217.
  • $defined(#expr) broken with binary. #2219
  • Method ambiguity when importing parent module publicly in private submodule. #2208
  • Linker errors when shadowing @Local with public function #2198
  • Bug when offsetting pointers of large structs using ++ and --.
  • x++ and x-- works on pointer vectors #2222.
  • x += 1 and x -= 1 works propertly on pointer vectors #2222.
  • Fixes to x += { 1, 1 } for enum and pointer vectors #2222.
  • Linking fails on operator method imported as @public #2224.
  • Lambda C-style vaargs were not properly rejected, leading to crash #2229.
  • Incorrect handling of constant null fault causing compiler crash #2232.
  • Overload resolution fixes to inline typedef #2226.
  • math::overflow_* wrappers incorrectly don't allow distinct integers #2221.
  • Compiler segfault when using distinct type in attribute imported from other module #2234.
  • Assert casting bitstruct to short/char #2237.
  • @tag didn't work with members #2236.
  • Assert comparing untyped lists #2240.
  • Fix bugs relating to optional interface addr-of #2244.
  • Compiler null pointer when building a static-lib with -o somedir/... #2246
  • Segfault in the compiler when using a bitstruct constant defined using a cast with an operator #2248.
  • Default assert() message drops parens #2249.

Stdlib changes

  • Deprecate String.is_zstr and String.quick_zstr #2188.
  • Add comparison with == for ZString types.
  • is_array_or_slice_of_char and is_arrayptr_or_slice_of_char are replaced by constant @ variants.
  • @pool now has an optional reserve parameter, some minor changes to the temp_allocator API
  • io::struct_to_format now supports bitstructs.
  • Add String.escape, String.unescape for escaping and unescaping a string.

Version 0.7.2

02 Jun 09:36

Choose a tag to compare

Changelist

Changes / improvements

  • Better default assert messages when no message is specified #2122
  • Add --run-dir, to specify directory for running executable using compile-run and run #2121.
  • Add run-dir to project.json.
  • Add quiet to project.json.
  • Deprecate uXX and iXX bit suffixes.
  • Add experimental LL / ULL suffixes for int128 and uint128 literals.
  • Allow the right hand side of ||| and &&& be runtime values.
  • Added @rnd() compile time random function (using the $$rnd() builtin). #2078
  • Add math::@ceil() compile time ceil function. #2134
  • Improve error message when using keywords as functions/macros/variables #2133.
  • Deprecate MyEnum.elements.
  • Deprecate SomeFn.params.
  • Improve error message when encountering recursively defined structs. #2146
  • Limit vector max size, default is 4096 bits, but may be increased using --max-vector-size.
  • Allow the use of has_tagof on builtin types.
  • @jump now included in --list-attributes #2155.
  • Add $$matrix_mul and $$matrix_transpose builtins.
  • Add d as floating point suffix for double types.
  • Deprecate f32, f64 and f128 suffixes.
  • Allow recursive generic modules.
  • Add deprecation for @param foo "abc".
  • Add --header-output and header-output options for controlling header output folder.
  • Generic faults is disallowed.

Fixes

  • Assert triggered when casting from int[2] to uint[2] #2115
  • Assert when a macro with compile time value is discarded, e.g. foo(); where foo() returns an untyped list. #2117
  • Fix stringify for compound initializers #2120.
  • Fix No index OOB check for [:^n] #2123.
  • Fix regression in Time diff due to operator overloading #2124.
  • attrdef with any invalid name causes compiler assert #2128.
  • Correctly error on @attrdef Foo = ;.
  • Contract on trying to use Object without initializing it.
  • Variable aliases of aliases would not resolve correctly. #2131
  • Variable aliases could not be assigned to.
  • Some folding was missing in binary op compile time resolution #2135.
  • Defining an enum like ABC = { 1 2 } was accidentally allowed.
  • Using a non-const as the end range for a bitstruct would trigger an assert.
  • Incorrect parsing of ad hoc generic types, like Foo{int}**** #2140.
  • $define did not correctly handle generic types #2140.
  • Incorrect parsing of call attributes #2144.
  • Error when using named argument on trailing macro body expansion #2139.
  • Designated const initializers with {} would overwrite the parent field.
  • Empty default case in @jump switch does not fallthrough #2147.
  • &&& was accidentally available as a valid prefix operator.
  • Missing error on default values for body with default arguments #2148.
  • --path does not interact correctly with relative path arguments #2149.
  • Add missing @noreturn to os::exit.
  • Implicit casting from struct to interface failure for inheriting interfaces #2151.
  • Distinct types could not be used with tagof #2152.
  • $$sat_mul was missing.
  • for with incorrect var declaration caused crash #2154.
  • Check pointer/slice/etc on [out] and & params. #2156.
  • Compiler didn't check foreach over flexible array member, and folding a flexible array member was allowed #2164.
  • Too strict project view #2163.
  • Bug using #foo arguments with $defined #2173
  • Incorrect ensure on String.split.
  • Removed the naive check for compile time modification, which fixes #1997 but regresses in detection.

Stdlib changes

  • Added String.quick_ztr and String.is_zstr
  • std::ascii moved into std::core::ascii. Old _m variants are deprecated, as is uint methods.
  • Add String.tokenize_all to replace the now deprecated String.splitter
  • Add String.count to count the number of instances of a string.
  • Add String.replace and String.treplace to replace substrings within a string.
  • Add Duration * Int and Clock - Clock overload.
  • Add DateTime + Duration overloads.
  • Add Maybe.equals and respective == operator when the inner type is equatable.
  • Add inherit_stdio option to SubProcessOptions to inherit parent's stdin, stdout, and stderr instead of creating pipes. #2012
  • Remove superfluous cleanup parameter in os::exit and os::fastexit.
  • Add extern fn ioctl(CInt fd, ulong request, ...) binding to libc;

Version 0.7.1

30 Apr 15:35

Choose a tag to compare

0.7.1 Change list

Changes / improvements

  • Better errors on some common casting mistakes (pointer->slice, String->ZString, deref pointer->array) #2064.
  • Better errors trying to convert an enum to an int and vice versa.
  • Function @require checks are added to the caller in safe mode. #186
  • Improved error message when narrowing isn't allowed.
  • Operator overloading for + - * / % & | ^ << >> ~ == != += -= *= /= %= &= |= ^= <<= >>=
  • Add @operator_r and @operator_s attributes.
  • More stdlib tests: sincos, ArenaAllocator, Slice2d.
  • Make aliases able to use @deprecated.
  • Refactored stdlib file organization.
  • Allow @if on locals.
  • String str = "" is now guaranteed to be null terminated. #2083
  • Improved error messages on Foo { 3, abc } #2099.
  • Foo[1..2] = { .baz = 123 } inference now works. #2095
  • Deprecated old inference with slice copy. Copying must now ensure a slicing operator at the end of the right hand side: foo[1..2] = bar[..] rather than the old foo[1..2] = bar. The old behaviour can be mostly retained with --use-old-slice-copy).
  • Added Enum.lookup and Enum.lookup_field.
  • c3c build picks first target rather than the first executable #2105.
  • New Win32 Mutex, ConditionVariable and OnceFlag implementation

Fixes

  • Trying to cast an enum to int and back caused the compiler to crash.
  • Incorrect rounding at compile time going from double to int.
  • Regression with invalid setup of the WASM temp allocator.
  • Correctly detect multiple overloads of the same type.
  • ABI bug on x64 Linux / MacOS when passing a union containing a struct of 3 floats. #2087
  • Bug with slice acces as inline struct member #2088.
  • @if now does implicit conversion to bool like $if. #2086
  • Fix broken enum inline -> bool conversions #2094.
  • @if was ignored on attrdef, regression 0.7 #2093.
  • @ensure was not included when the function doesn't return a value #2098.
  • Added missing @clone_aligned and add checks to @tclone
  • Comparing a distinct type with an enum with an inline distinct type failed unexpectedly.
  • The %s would not properly print function pointers.
  • Compiler crash when passing an untyped list as an argument to assert #2108.
  • @ensure should be allowed to read "out" variables. #2107
  • Error message for casting generic to incompatible type does not work properly with nested generics #1953
  • Fixed enum regression after 0.7.0 enum change.
  • ConditionVariable now properly works on Win32

Stdlib changes

  • Hash functions for integer vectors and arrays.
  • Prefer math::I and math::I_F for math::IMAGINARY and math::IMAGINARYF the latter is deprecated.
  • Add array::contains to check for a value in an array or slice.

Version 0.7.0

30 Mar 12:08

Choose a tag to compare

Changes / improvements

  • Removed Foo { 1, 2 } initializer.
  • Changed Foo(<int>) to Foo {int}.
  • Removed {| |} expression blocks.
  • Removed macro &ref and $varef parameters.
  • Removed $vaexpr(0) syntax in favour of $vaexpr[0]
  • Enum does not cast to/from an integer (its ordinal).
  • Removed use of void! for main, test and benchmark functions.
  • Removed $or, $and, $concat compile time functions.
  • Removed @adhoc attribute.
  • Disallow inline use of nested generics (e.g. List{List{int}}.
  • Remove .allocator = allocator syntax for functions.
  • Remove @operator(construct).
  • Removal of "any-switch".
  • Allow swizzling assign, eg. abc.xz += { 5, 10 };
  • Added $$wstr16 and $$wstr32 builtins.
  • $foreach "()" replaced by trailing ":" $foreach ($x, $y : $foo) -> $foreach $x, $y : $foo:
  • $for "()" replaced by trailing ":" $for (var $x = 0; $x < FOO; $x++) -> $for var $x = 0; $x < FOO; $x++:
  • $switch "()" replaced by trailing ":" $switch ($Type) -> $switch $Type:
  • Empty $switch requires trailing ":" $switch -> $switch:
  • Rename @return! to @return? and change syntax to require ":" after faults.
  • Remove if (catch foo) { case ... } syntax.
  • Remove [?] syntax.
  • Change int! to int? syntax.
  • New fault declaration using faultdef.
  • Enum associated values can reference the calling enum.
  • Improve error message on foo ?? io::EOF with missing '?' #2036
  • Make @public import recursive. #2018
  • Fault nameof prefixes the first last module path, for instance std::io::EOF is rendered as io::EOF.
  • Rename def to alias.
  • Change distinct -> typedef.
  • Order of attribute declaration is changed for alias.
  • Added LANGUAGE_DEV_VERSION env constant.
  • Rename anyfault -> fault.
  • !!foo now works same as as ! ! foo.
  • Temp allocator now supports more than 2 in-flight stacks.
  • Printing stacktrace uses its own temp allocator.
  • Allow inferred type on body parameters. E.g. @stack_mem(1024; alloc) { ... };
  • Use @pool_init() to set up a temp pool on a thread. Only the main thread has implicit temp pool setup.
  • tmem is now a variable.
  • Compile test and benchmark functions when invoking --lsp #2058.
  • Added @format attribute for compile time printf validation #2057.
  • Formatter no longer implicitly converts enums to ordinals.

Fixes

  • Fix address sanitizer to work on MachO targets (e.g. MacOS).
  • Post and pre-decrement operators switched places for vector elements #2010.
  • Aliases were incorrectly considered compile time constants.
  • FreeBSD libc stat definitions were incorrect.
  • Atomic max was incorrect.
  • "+".to_float() would panic.
  • import can now both be @public and @norecurse.
  • Crash when trying to convert a struct slice to a vector #2039.
  • Crash resolving a method on Foo[2] when Foo is distinct #2042.
  • Bug due to missing cast when doing $i[$x] = $z.
  • Incorrectly allowed getting pointer to a macro #2049.
  • &self not runtime null-checked in macro #1827.
  • Bug when printing a boolean value as an integer using printf.
  • Show error when a generic module contains a self-generic type.
  • "Single module" was not enforced when creating a static library using as a project target.

Stdlib changes

  • new_* functions in general moved to version without new_ prefix.
  • string::new_from_* changed to string::from_*.
  • String.to_utf16_copy and related changed to String.to_utf16.
  • String.to_utf16_tcopy and related changed to String.to_temp_utf16
  • mem::temp_new changed to mem::tnew.
  • mem::temp_alloc and related changed to mem::talloc.
  • mem::temp_new_array changed to mem::temp_array.
  • Add ONHEAP variants for List/HashMap for initializing global maps on the heap.
  • Remove Vec2 and other aliases from std::math. Replace .length_sq() with sq_magnitude()
  • Change all hash functions to have a common hash function.
  • @wstring, @wstring32, @char32 and @char16 compile time macros added.
  • Updates to Atomic to handle distinct types and booleans.
  • Added math::iota.
  • @pool no longer takes an argument.
  • Allocator interface removes mark and reset.
  • DynamicArenaAllocator has changed init function.
  • Added BackedArenaAllocator which is allocated to a fixed size, then allocates on the backing allocator and supports mark/reset.
  • AnyList now also defaults to the temp allocator.
  • os::getcwd and os::get_home_dir requires an explicit allocator.
  • file::load_new and file::load_path_new removed.
  • os::exit and os::fastexit added.