Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

2025-01-16: Fuzion January Update

December was a busy month. This month, we're a bit earlier with our latest changes:

  • General
    • December was Advent-of-Code time, you find Fuzion solution to all 25 puzzles! Working on these puzzles resulted in positive input for Fuzion, a total of 55 issues where opened, about half of them for API improvements and half for compiler improvements like bugs or enhanced error messages.

    • There will be a presentation on Fuzion at FOSDEM:

      Effects Everywhere: Error Handling and Design-By-Contract in Fuzion by Fridtjof Siebert on Sunday 12h30 in room H.1308 in the Declarative and Minimalistic Computing devroom. Hope we meet there, or you join online!

  • Base library
    • New features

      • add Sequence.count(f T->bool) (#4382) so one can write

            say "{persons.count (p -> p.age < 18)} kids"
                    

        instead of

            say "{persons.filter (p -> p.age < 18) .count} kids"
                    
      • net: add ip_address feature (#4417)

      • fuzion/java: pass Pointers to call_* instead of Java_Object (#4431)

      • rename Sequence.concat_sequences as Sequence.concat (#4450)

      • mutate: array: convenience feature for initialization (#4467)

      • add set [] to Mutable_Map as alias for add (#4498)

      • Add Sequence.as_*tuple[s], fix #4501 (#4502)

             say ([1,2,3,4,5,6].as_3tuples.map t->t.0+t.2)
                    

        which will convert the sequence into [(1,2,3),(4,5,6)] and then sum the first and last tuple elements to produce [4,10].

      • To avoid quadratic performance, added foldr* to list and Sequence, use foldr in String.type.join (#4532)

      • Add new mechanism for function memoization (#4543)

        say you have a function fib that performs poorly because it lacks memoization:

            fib(n) =>
              if n <= 1 then 1 else fib n-1 + fib n-2
                    

        you can now memoize this as follows

            fib(n) i32 : memoize => keep n _->
              if n <= 1 then 1 else fib n-1 + fib n-2
                    
    • Changed features

      • Sequence.sort now requires elements to be (totally) orderable (#4347)

      • Sequence is now the preferred result type, even for features that internally create a list (#4383, #4391)

      • mutate: array2: value initialization consistent with mutate.array (#4466)

      • Remove mutate parameter from io.stdin, add convenience features (#4485)

      • don't return line for final newline in io.buffered.read_lines (#4496)

      • change Const_String to const_string (#4521)

      • cleanup, move alloc, getel, setel to type features. (#4523)

      • io: flush buffers on every say/yak etc. (#4511)

      • fuzion java: simplify result type of array_to_java_object0 (#4520)

      • correct result type of fzE_file_close (#4527)

      • rename log feature as io.log (#4476)

      • use pipes operator in some places (#4530)

  • Parser
    • fix require-condition in setSourceRange (#4372)

    • allow target of inheritance in parenthesis (#4393)

  • Front End
    • replace $MODULE in error message with name of fum file, e.g., {base.fum}/Sequence.fz (#4499)

    • bug fixes
      • fix nested tuples (#4407), allowing code like

            x := tuple 1 (tuple 2 3)
            say x.values.1
            say x.1.values.1
                    

        Note that x.1.1 currently does not work yet (#2913)

      • robustness of setActualResultType in case of errors (#4333)

      • fix type parameter constraints in pre/post features (#4406)

      • fix field access for tuples, e.g., x.1, if type is a type parameters with tuple as constraint (#4409)

      • Fix confusing error created in case of wrong number of type parameters in a call (return null for asType of partialargs) (#4448)

      • Fix crash during argument type inference from actual args (fix result type once inferred) (#4453)

      • fix unjustified errors reported on calls performed in parentheses (do not propagate for partial if operator call in parentheses). (#4482)

      • addDeclaredOrInherited: relax pre-condition on errors (#4373)

      • fix name clash of type features in different modules (#4381)

      • allow initial value in if/else (#4388)

    • cleanup
      • AbstractType.isRef change result type to YesNo (#4300)

      • removed code duplication in AbstractFeature.typeCall and AbstractCall.typeCall (#4314)

      • rename isFunctionType/isAnyFunctionType (#4361)

      • optimize recording of used fields (#4411)

      • replace isFunctionTypeExcludingLazy by isFunctionType (#4442)

      • refine isAssignableFrom checks (#4452)

      • merge Call.ERROR and Expr.ERROR_VALUE (#4385)

  • Middle End
    • DFA: fix type of valueset of original of TaggedValue (#4470)

    • DFA: override accessedClazz (#4517)

    • move some abstract from GeneratingFUIR to FUIR (#4437)

    • move abstract methods from GenFUIR to FUIR (#4441)

    • cleanup, move methods from GenFUIR to FUIR (#4493)

    • do not add code when lookup done (#4438)

    • remove declarationPos (#4519)

    • effects: fix a require-condition in DFA.java (#4397)

    • ir: programmatically calc CLAZZ_END, SITE_BASE, etc. (#4432)

    • abstract interpreter: assignStatic only for values that have data (#4477)

  • All back ends
    • replace fuzion.java.Java_Object/Array with fuzion.sys.Pointer (#4340)

  • JVM back end
    • cleanup, copying from/to MemorySegment from array (#4336)

    • -jar, -classes fix `UnsupportedClassVersionError` (#4369)

    • copy libfuzion when creating jar/classes outside fuzion directory (#4489)

    • add Expr.trace() emitting stacktrace as comment (#4444)

  • C back end
    • remove FILE from header file (#4337)

    • fix parameter fzouter set but not used (#4390)

    • CodeGen.call, simplify code (#4475)

  • Interpreter back end
    • fix toNative for i8/i16/u8/u16 (#4338)

    • use DFA fuir directly (#4522)

  • Native
    • move fileio features to native (#4488)

    • replace some posix code by native windows (#4370)

  • fz command
    • set -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 (#4392)

  • Docs
    • In generated Fuzion API docs, add ... for open types (#4376)

    • replace all non-ascii in urls and paths (#4387)

    • make doc: include java docs (#4458)

  • Build Infrastructure
    • fix building fuzion runtime (#4339)

    • add build target for java docs (#4356)

    • run_tests_jar, fix for spaces in directory (#4363)

    • remove python3 dependency (#4366)

    • fix target debug_api_docs not working on first run (#4371)

    • lint/javadoc: include syntax and html checks (#4464)

    • add .DELETE_ON_ERROR (#4497)

  • Tests
    • Add regression tests: #1591, #2653, #2719, #3565, #4220, #4426 (#4344, #4345, #4394, #4447)

    • update, nested_choice_negative (#4396)

    • add effects test (#4403)

    • switch #118 from front end only to simple test (#4410)

Cheers,

--The Fuzion Team.

last changed: 2025-01-16