Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal

2025-04-11: Fuzion April Update

Last month, the focus has shifted towards a number of minor Fuzion language improvements, cleaning up syntax sugar that was rarely used, disallowing confusing syntax and improving type inference.

Furthermore, important progress is happening on the native interface.

  • General
    • We are happy to welcome Nina Hinkkanen from Finland for an internship until May at Tokiwa Software GmbH!

  • Fuzion language
    • remove of keyword (#4983). The syntax sugar of the form

        fruit : choice of apple, pear, banana.
              

      now has to be written as

        apple is
        pear is
        banana is
        fruit : choice apple pear banana is
              
    • remove full stop (#4979). Empty feature declarations like

        point2D (x, y i32).
        point3D (x, y, z i32).
              

      now have to be written using is, even if nothing follows:

        point2D (x, y i32) is
        point3D (x, y, z i32) is
              
    • require is keyword for anonymous feature declaration (#4956), i.e., instead of

        nul String =>
          ref : String
            public redef utf8 Sequence u8 => [u8 0]
              

      the new syntax is:

        nul String =>
          ref : String is
            public redef utf8 Sequence u8 => [u8 0]
              
    • the code of an anonymous feature now must be indented further than ref (#4976). So instead of

        nul String := ref : String is
            public redef utf8 Sequence u8 => [u8 0]
              

      we now require

        nul String := ref : String is
                        public redef utf8 Sequence u8 => [u8 0]
              

      or

        nul String :=
          ref : String is
            public redef utf8 Sequence u8 => [u8 0]
              
    • Restrict possibilities for indentation of else (#4948), disallowing confusing cases such as

        if c0 then "-true-"
              else if c1 then "-false::true-"
        else       "-false::false-"    # 1. should flag an error: inconsistent indentation
              

      or

        if c0 then "-true-"
        else if c1 then "-false::true-"
             else if c2       "-false::false::true-"
        else             "-false::false::false-" # 2. should flag an error: inconsistent indentation
              
    • forbid setting argument visibility on non constructor features (#4904)

    • Enable partial application for string literals, numeric literals and operator calls (#4867). This avoids the explicit use of lambda: instead of

        log_string(s ()->String) => if logging then say s()
        log_i32(s ()->i32) => log_string ()->"i32:{i()}"
        log ()->"test"
        log ()->4711
              

      one can now write

        log_string(s ()->String) => if logging then say s()
        log_i32(s ()->i32) => log_string "i32:{i()}"
        log "test"
        log 4711
              
    • improve type inference for calls to flat_map, bind where the type parameter must be inferred from the type parameter of a lambda result (#4916). This simplifies code like

        say ([1,2,3].flat_map i32 x->[x,x])
              

      to

        say ([1,2,3].flat_map x->[x,x])
              
    • allow fixed implementation alongside abstract feature declaration(#4934)

    • redefined features no longer inherit visibility of original feature (#4915)

    • partial application now works for select (#4936). This is very useful for accessing elements in a tuple, e.g., as follows:

      The following code sums up the first elements of a Sequence of tuples, resulting in 8:

        say ([(3,4),(5,6)].map (.0) |> .sum)
              

      while this sums up the second elements of a Sequence of tuples, resulting in 10:

        say ([(3,4),(5,6)].map (.1) |> .sum)
              

      This can also be used for nested tuples

        say <| [(".0",(".1.0", ".1.1"))].map (.1.0)
        say <| [(".0", ((".1.0.0", ".1.0.1"), ".1.1"))].map (.1.0.1)
              

      or tuples of arrays

        say <| [(0,[1,2,3],0), (1, [4,5,6], 1)].map (.1[2])
              

      or with subsequent calls

        say <| [("a","b","c"), ("d","e","f")].map (.2.as_string)
              
  • fz command
    • fz: option -saveLib of the fz command is now called -save-module (#4888)

  • Base library
    • New base library features

      • time: add skeleton implementation for calendar_duration (#4905)

      • time/calendar_duration: implement as_string (#4939)

      • time/date_time: use month and day arguments instead of day in year (#4872)

      • added Mutable_Hash_Map (#4873)

    • Changes to the following standard library features

      • When reading form io.stdin, no longer block until EOF/ctrl-D to allow interactive input terminated with the return key(#4894)

  • Documentation
    • fix display of constraint for type parameters (#4881)

    • make API sources link configurable (#4930)

  • Parser
    • create better error when parsing numeric literals like 1e3 with lowercase exponent indicator (#4923)

    • fix ebnf grammar that contained reference to non-existing rule op, which is now OPERATOR (#4951)

  • Front End
    • resolveSyntacticSugar2, performance enhancements (#4921)

    • bug fixes
      • Match.typeForInferencing return null on error (#4919)

      • fix NPE in Select.toString (#4958)

      • fix NullPointerException for target of Select (#4960)

      • suppress subsequent errors in case of type inference of lambda error (#4931)

      • add check for argument and result types of native features (#4850)

      • allow setting feature name for features with arguments (#4969)

      • do not implicitly assume result type to be void (#4974)

      • fix class cast exception (#4968)

      • fix issue with type inference of inheritance call of cotypes (#4891)

      • fix logic in isExtensionFeature (#4889)

      • fix type parameter inference for inheritance call (#4890)

  • Middle End
    • dfa: genericResult return null if result is void (#4876)

    • dfa: native, dummy call function args (#4878)

    • fuir: add convenience method, fuir clazzNativeName (#4848)

    • fuir: isTailCall return true if site always results in void (#4243)

  • Back Ends
    • native: add upcalls, i.e., passing Fuzion function for callback to native code (#4926)

  • Build
    • now shows reason if test was cancelled because of timeout or stack limit (#4954)

    • now shows the slowest tests after a test run (#4973)

  • Tests
    • fix test sqlite on windows (#4982)

    • add regression test for #2489, partial application with type inference (#4871)

  • Windows
    • fix error: 'poll.h' file not found (#4977)

Cheers,

--The Fuzion Team.

last changed: 2025-04-11