Skip to content

Releases: navi-language/navi

v0.15.1

18 Feb 02:09
Compare
Choose a tag to compare

Pkg

  • Fix longport module.

v0.15.0

17 Feb 01:49
Compare
Choose a tag to compare

Language

  • Allow generic parameters to be passed to closures.

    fn a<T>() {
        let _b = || b::<T>();
    }
    
    fn b<T>() {}
    
  • Add new array initialization syntax.

    let b = [99; 10]; // Used to initialize an array of length 10, with each element having the value 99
    
  • Add new Bytes initialization syntax.

    use std.io.Bytes;
    let b: Bytes = [1, 2, 3, 4, 5];
    

Tools

  • Add nvs command.

Stdlib

  • Add std.worker module.
  • Add WorkerPool type that can be created with std.worker.Worker.pool method.

v0.14.0

11 Nov 03:46
Compare
Choose a tag to compare

Language

  • Add support multi-case switch statement.

    switch(a) {
        case 1, 2:
            println("a");
        case 10, 20:
            println("b");
        default:
            println("c");
    }
  • Enum literals can omit the type when the type can be inferred.

    enum Color {
        Red,
        Green,
        Blue,
    }
    
    let color: Color = .Red;
    
    fn value(color: Color): int {
        // ...
    }
    
    value(.Red);

Stdlib

  • Add std.crypto.AssociatedOid interface.
  • Add std.crypto.aes, std.crypto.chacha20, std.crypto.ecdsa, std.crypto.ed25519, std.jwt modules.
  • Add std.crypto.BlockPadding, std.math.BigInt.
  • Add std.io.Bytes.chunks method.
  • Add std.io.Bytes.push, std.io.Bytes.pop methods.

Internal

  • Fixed switch statement maybe caused JIT to not work. (tests\compile-err\switch\passed\nested.nv)

v0.13.0

30 Sep 04:20
Compare
Choose a tag to compare

Language

  • Add support for keyword arguments use in generic functions.

  • Cast to the source type

    type A = int;
    type B = A;
    let a: A = 1 as A;
    let b: B = 1 as B;
    let n = b as int; // cast to the source type
    
  • Add support x?.(type) syntax

    let a: Any? = 10;
    assert_eq a?.(int), 10;
    
  • Add support import global var

    import std.net.http.NotFound;
    let status = NotFound;
    

Stdlib

  • Remove std.json.from_string, std.json.from_bytes, std.json.from_reader methods, use std.json.parse instead.
  • Remove std.xml.from_string, std.xml.from_bytes, std.xml.from_reader methods, use std.xml.parse instead.
  • Remove std.yaml.from_string, std.yaml.from_bytes, std.yaml.from_reader methods, use std.yaml.parse instead.
  • Improve std.process, std.regex.
  • Rename std.decimal.Decimal.from_string to std.decimal.Decimal.parse.
  • Use std.template to render file list in std.net.http.server.FileSystem.
  • Add support custom filter/function/tester for std.template.
  • Move std.io.StringBuffer to std.str.StringBuffer.
  • Rename std.io.StringBuffer.push to std.io.StringBuffer.push_string.
  • Add std.io.StringBuffer.push, std.io.StringBuffer.pop methods.
  • Add StatusCode.is_ok, StatusCode.is_success, StatusCode.is_client_error, StatusCode.is_server_error, StatusCodeis_redirection methods.
  • Improve string.bytes for better performance.
  • Remove std.base64.decode_to_string, std.base64.encode_bytes, std.base64.encode_string methods.
  • Add std.base64.Base64Encoder, std.base64.Base64Decoder.
  • Add std.net.http.CookieKey.from_bytes, std.net.http.CookieKey.bytes methods.
  • Add support for serialize/deserialize std.io.Bytes.
  • Rename std.time.DateTime.now to std.time.DateTime.now_utc.
  • Remove std.time.DateTime.timezone method.
  • Add std.time.DateTime.offset method to get the offset from UTC in seconds.
  • Change the argument of std.time.DateTime.to_offset method' to UTC seconds.
  • Remove std.time.parse, std.time.now, std.time.from_timestamp functions.
  • Add std.time.TimeZone.
  • Add std.time.DateTime.to_timezone method to convert the DateTime to a specific timezone.
  • Add std.net.http.Status.as_int, std.net.http.Status.from_int methods.
  • Improve std.regex to remove Navi wrapping code.
  • Improve std.env to remove Navi wrapping code.
  • Improve std.fs to remove Navi wrapping code.
  • Remove std.fs.open, std.fs.create, std.fs.write_bytes functions.
  • Change the return value of std.fs.glob and std.fs.read_dir functions to a iterator.
  • Remove std.fs.Metadata.new method use std.fs.metadata instead.
  • Add std.hex module.
  • Remove std.io.Bytes.encode_to_string method.
  • Add std.rand.RandReader.
  • Rename std.io.Bytes.concat to std.io.Bytes.append.
  • Rework std.crypto.
    • Add Hash interface.
    • Add md4, md5, sha1, sha2, ripemd, sha3, blake2, blake3 sub modules.
    • Add hmac, rsa sub modules.

Internal

  • Alloc defer closure in the function stack.
  • Improve pass generic params to the native functions.

v0.12.0

15 Sep 02:40
Compare
Choose a tag to compare

Language

  • Add support for convert error types with try statement.

  • Add support for method as static closure.

  • Add support for implicit conversion of an interface to its parent interface.

  • Add support for cast an interface to its parent interface.

  • Add support for unescape unicode sequences.

  • Add support for let else statement.

    let a: int? = 10;
    let b = a {
        panic "unreachable";
    }
    assert_eq b, 10;
  • Add support for try? for expressions that don't return a value.

  • Add support for accessing char at specific positions in a string using the s[x] syntax.

    let s = "hello";
    assert_eq s[0], 'h';
    assert_eq s[1], 'e';
  • Add support for custom iterator.

  • Add support for destructuring assignment.

    struct Point {
        x: int,
        y: int,
    }
    
    let p = Point {1, 2};
    let Point { x, y } = p;
    assert_eq x, 1;
    assert_eq y, 2;

Stdlib

  • Add std.io.Seek interface.
  • Add std.io.pipe method to creates a synchronous in-memory pipe.
  • Implement Debug for std.io.Bytes, std.decimal.Decimal.
  • Add std.compress, std.mime, std.net.http, std.net.http.date, std.net.http.server, std.net.http.client.websocket, std.template modules.
  • Rework std.net, std.net.http.client modules.
  • Fix deserialize to union type.
  • Add update time component methods.
  • Add from argument to std.str.string.find method.
  • Rename std.path.base function to std.path.file_name and return string?.
  • Rename std.path.dir function to std.path.parent and return string?.
  • Add std.fs.read_dir function.
  • Add std.io.Read.take, std.io.ReadClose.take_close methods.

Pkg

  • Add parquet module.

Tools

  • Print warnings in run/compile commands.

v0.11.0

07 Jun 14:48
Compare
Choose a tag to compare

Language

  • Now we published release for Windows platform.

  • Improved the Closure syntax to support write in one line.

    let s: string? = "hello";
    
    // Before
    s.map(|x| {
      return `${x} world`;
    });
    
    // After
    s.map(|x| `${x} world`);
  • spawn, defer now support without block.

    spawn println("hello");
    defer println("world");
    • And with this support, we have to changed empty map initialization from {} to {:}.
  • Add #[track_caller] annotation for function, see also: Track Caller

    #[track_caller]
    fn assert_success(value: bool) {
        assert value == true;
    }
    
    test "assert_success" {
        assert_success(true);
        assert_success(false);
    }

    Will output:

    error: thread 'thread 1#' at 'assertion failed: value == true', test.nv:8
    
    stack backtrace:
      0: test#0()
         at test.nv:8
    
  • Improve init array with rest expr:

    let a = [1, 2, 3];
    let b = [..a, 4, 5];
  • Add to support unescape in char.

    let c = '\n';

Stdlib

  • Add std.net.tcp module, and here is a guides: Echo Server
  • Add std.fs.copy.
  • Add std.io.BufReader, std.io.BufWriter.
  • Add flush method to std.io.Write interface.
  • Add std.str.Debug to create debug string with Debug interface.
    struct MyType {}
    
    impl Debug for MyType {
      fn inspect(self): string {
        return "MyType";
      }
    }
    
    let my_type = MyType{};
    assert_eq `${my_type:?}`, "MyType";
  • Add std.backtrace module to get backtrace info.
  • Add std.env.join_paths method.
  • Improve std.net.http, removed form, multipart argument, let body support more types.
  • Improve array's unique, reverse, sort, sort_by, resize, truncate, clear to return it self.
  • Imporve std.process to add Command, process.run now returns Child instance.
  • Imporve std.fs, std.process internal handle for better performance.
  • Improve std.path.join to supports arbitrary argument: path.join("a", "b", "c", "d").
  • Improve std.crypto, let update and hmac function to support string | Bytes.
  • Fix path join to use push avoid crate Path object.
  • Rename std.url.URL -> std.url.Url.

Pkg

  • Done with longport package.

Tools

We have rewrote navi test, navi doc command, and build a new stdlib docs.

https://navi-lang.org/stdlib/std.crypto

Now, there have more details in the docs, and we will keep improving it.

  • navi doc is rewritten with new output format for better to generate docs.

  • Improve navi test with parallel test running and we optimized the test result output.

    test main2.nv                                                            1/1    ok 0ms                                                          
    test main.nv                                                             2/2    ok 0ms
    
  • Improve navi test --doc to show the correct line number in Markdown file.

  • Add Navi info print when run navi test, navi bench command.

    Navi 0.11.0 (x86_64-apple-darwin, a76be5f7, 2024-06-07 01:12:17 +08:00)
    
  • Temporary workaround for apple-darwin-aarch64 to print backtrace.

Other changes

  • fmt: leave comma in multi-line array_list.
  • fmt: if there is no code in a closure, just an empty {}, no line breaks.
  • fmt: Fix missed the function attributes.
  • lsp: use custom display_value_type only for inlay hint.
  • lsp: call display on ValueType in autocomplete.
  • lsp: find_navi_toml_pathbuf and all *.nv thereunder for cache.
  • lsp: look for immediate parent dir in create_compile_options.
  • lsp: find cache's member info to do when cfg debug assertions
  • lsp: auto complete global vars of a Module.
  • lsp: check the client’s capabilities and returns either a simple code action capability or a detailed set of supported code action kinds.
  • lsp: allow retrying in dispatch.
  • lsp: skeleton of handle_code_action, handle_code_action_resolve.
  • lsp: search cache_stdlib, cache_userlib to generate fix advice.

v0.10.1+nightly-20240514

14 May 08:51
Compare
Choose a tag to compare
Pre-release
Update tests

v0.10.1+nightly-20240513

13 May 07:34
Compare
Choose a tag to compare
Pre-release
Update tests

v0.10.1+nightly-20240512

12 May 17:51
Compare
Choose a tag to compare
Pre-release
Update tests

v0.10.1+nightly-20240511

11 May 08:12
Compare
Choose a tag to compare
Pre-release
Update tests