Skip to content

sysl 0.9.1

Choose a tag to compare

@edadma edadma released this 05 Nov 11:41
· 1116 commits to dev since this release

sysl 0.9.1 is a patch release on 0.9.0. It makes the standard library's descriptors close themselves, settles a generic result at &T as Rust does, keeps sysl lsp up with typing, and fixes a run of generics, closure and reflection bugs. It adds sysl.io.wait, associated-type requirements, alternatives at a binding and compile-time comparisons through Eq/PartialOrd.

Install

brew install sysl-lang/tap/sysl

or download sysl-0.9.1-darwin-arm64.tar.gz below and put its bin/ on your PATH; the compiler finds share/sysl/library beside itself.

Behaviour changes (read these first)

  • A File, Socket, UdpSocket or UnixListener closes its descriptor when its last copy is dropped, as in Rust. A File first hands over what it buffered.
    • A descriptor taken with fd(), handed to C and kept after the value is dropped is now closed under C's feet. Use the new into_raw_fd() to take ownership.
    • A socket's second close answers NotOpen and closes nothing.
    • On freestanding targets, a program that makes a socket or opens a file is asked for sysl_net_close / sysl_fs_close even if it never calls close.
    • Docs: library/fs.md, library/net.md.
  • A generic call whose result is a bare type parameter settles that parameter at &T when it stands at a &T parameter or binding, as Rust does. It used to settle it at T and box a copy. bump(pick(m)) now mutates m, and a type with a Drop is no longer refused there. An argument that settles the parameter still wins. A parameter whose bounds &T does not meet is still read at T. Docs: reference/generics.md.

New

  • into_raw_fd() on File, Socket, UdpSocket and UnixListener; fd() on the socket types.
  • sysl.io.wait: a descriptor can be waited on with a time limit.
    • The calls are ready(fd, Readable|Writable, timeout), and readable/writable on FdReader and File.
    • An interrupted wait is retried for the time still owed, and a wait never answers early.
    • It works on a terminal on macOS, whose poll cannot wait on one.
    • Docs: library/io.md, api/sysl-io-wait.md.
  • A requirement may fix an associated type, as Rust's Iterator<Item = i32> requirement does: trait Doubles: Seq[Item = int].
    • A T: Doubles body reads T::Item as int.
    • Every impl of the requiring trait is held to that type.
    • Two requirements that fix it differently are refused at the trait.
    • This was refused before. Docs: reference/traits.md.
  • Alternatives at a binding: val (Ok(x) | Err(x)) = r.
    • A val, var or for pattern with | alternatives that together cover the type binds each name from whichever alternative matched, as Rust's let does.
    • Alternatives that miss a value are refused in a binding's words.
    • An unparenthesised val A(x) | B(x) = v is refused with a hint.
    • Docs: reference/patterns.md.
  • Comparisons through Eq/PartialOrd run while compiling: < <= > >= == != through a written or derived impl.
    • They work in a const, an if const and a const function's body.
    • A module val over one is laid down as data, so it also builds for a freestanding target.

Fixes

  • sysl lsp no longer falls behind while you type. Changes that arrive faster than they can be analysed are coalesced: only each file's latest text is analysed, after 120 ms of quiet input. On avin's 43.7k-line package, diagnostics now arrive 5.6 s after the last of 40 keystrokes typed at 150 ms; before, it was 154 s. Hover and definition always answer for the latest text.
  • sysl lsp checks a standard-library file the way sysl test --std does, instead of refusing it for sitting at the project root. A file with no manifest above it, in a directory tree that spells its module's name, is compiled with that tree. Docs: getting-started/cli.md.
  • A closure handed to a function whose result is kept in a local was laid in the caller's frame and read after the frame was gone. This happened when that function put the closure in a slice literal, a repeat, or a view of an array, for a callee that answers what it reads through the view. syslUI's centred(button(...)) bound by a val segfaulted tuner's tests. The closure is now boxed on the heap.
  • Two generic impl blocks over one type whose parameters share a name now keep their own bounds. Before, if the bounds differed only in an associated type they fixed (T: Seq[Item = int]) or asked of (T: Seq[Item: Mul]), the blocks shared one instantiation of the type. One block then lost its bound ('*' needs 'T::Item: Mul'), or a weaker block was accepted on the other's promise.
  • At a generic's definition, an undefined name is now reported even when it stands beside a name bound by a pattern over a type parameter's value: m + nope, f(m, nope), m.method(nope), m[nope], if m == nope, and the same in a closure or an is block. Before, it went unreported unless the generic was called. Calling such a name, m(x), is no longer refused at the definition; the call is judged at each instantiation.
  • Calling the result of a call that hands back a closure (m()(4), f()()(1), fs()[0](3)) was refused with '*self' needs a variable, field, or dereference to point at. The temporary is now given a slot, as Rust does.
  • Kind.Trait was documented but unreachable. View::Kind, View::Name and View::BaseName now answer for a trait, whether bare, generic with its arguments, or imported. So does T::Kind where a trait stands in for T, so if const T::Kind == Kind.Trait works. Layout queries, and a trait used as a layout, stay refused. Docs: reference/reflection.md.
  • A module-qualified type name answers its type attributes. geo.Point::Kind, a.b.T::Fields, geo.Pair[int]::Name and every other :: attribute were refused as a value on the left of ::; they now answer as the imported spelling does. Docs: reference/attributes.md.
  • A comparison chain in a const (1 < 2 <= 2) now folds.
  • A link through lld that crashed with a signal, because lld and LLVM were different versions, was reported as an opaque linker crash. Now a link killed by a signal, or any failing LTO link, names the lld and LLVM versions and the fix.

Tests

  • Full suite, SYSL_DOCS=1 with stage 2, on the release line before the stamp (merge train 142, 36564422): 22889 passed, 1 failed, 3 ignored. The one failure was a fixture in tests_odr_os_directory (the hosted C list now includes wait.c), fixed in 1900a44; train 143 (23af5db) re-ran that file: 30 passed, 0 failed.
  • sysl test library --std on train 142: 1820 passed, 0 failed. On the 0.9.1 stamp over 23af5db, built by the release script: 1820 passed, 0 failed; the stamped tree's stage-2 comparison (tests_self): 3 passed, 0 failed.
  • The three-stage build agrees (stage 1 and stage 2 emit identical LLVM).
  • The org build census was not run for this release: the org is part-way through its sweep for 0.9.0's breaks (Buf.at/set, float Ord). Of the consumers, sblas was run on the candidate and passes.