Skip to content

Pepper v0.3.0

Choose a tag to compare

@justinboswell justinboswell released this 19 Oct 04:45
· 447 commits to main since this release

Pepper v0.3.0: everything merged since v0.2.1. Grouped by area, with each pull request linked.

The VS Code extension is published as release vsix-v0.3.0.

Breaking changes

  • The compiler binary is pep-build, and a new pepper entry point runs the tools (pepper build, pepper help, ...); pepper main.pep still works with a deprecation warning (#421)
  • pepper-lsp and pepper-docgen are renamed pep-lsp and pep-doc (#426)
  • Integer arithmetic traps on overflow; explicit wrapping operations do the old thing (#372)
  • Optional's cases are Empty and Value (#429)
  • as is a checked static cast; unsafe_cast<T> does reinterpret casts (#403)
  • Array.find and the Path accessors return optionals (#276)
  • print takes Strings; floats and tuples get to_string (#216)
  • [LinkName] is replaced by [Link(name = ...)] (#357)
  • Exported names live in per-module namespaces (#298)

Language

  • Pattern matching: guards on match arms (#435), ranges and module-scope constants in patterns (#439), nested patterns (#445)
  • The ? operator propagates Result errors and empty Optionals (#433)
  • ** raises floating-point numbers to a power (#437); a number on the left of an operator can call an extension operator (#440)
  • Function values: extern functions (#438), a bare method name inside a method (#436), generic methods (#444), generic functions whose type arguments come from the slot (#441), and closures in trait default methods can use this (#446)
  • Overloading an extern is reported, with what to do instead (#442)
  • Static blocks, the reflect API and [Attribute] structs (#402); module-scope static blocks compute constants (#420); while, break and continue run at compile time (#416)
  • Built-in attributes are declared in the runtime and their values reflected (#422); qualified attribute names like [serialize.Ignore] (#428)
  • Named arguments for calls and attributes (#357), with parameter-name hints and completion (#358)
  • Properties on structs, traits and extensions (#356)
  • Value structs: [Value] and a value Optional (#306), boxing and value iterators (#307), value enums, with Result and Optional as value enums (#308)
  • Ranges a..b and a..>b (#315); iterator adapters enumerate, zip, to_array (#317)
  • Trait values can be copied (#353); extend X with Trait; needs no body (#333)
  • One overload set can mix exported and private members (#321) and span the files of a module (#323)
  • Asserts and panics print their source location (#427)
  • Type inference: through sibling bounds and partial type arguments (#336), generic var declarations (#401), sizeof<T>() (#342), match and ?: arms of different numeric types (#309), type arguments in ternary arms (#398)
  • New and better errors: uninferred generic method calls (#341), enum and bound methods read without a call (#417), function-type mismatches located and reworded (#400), a type exported by two prelude files (#363), codegen's unknown-type errors located (#330)
  • Fixes: a parameter typed T in a generic match arm (#443), chained overloaded indexers and an enum case named String (#413), string literals through C function pointers (#406), long collection literals no longer overflow the stack (#397), a value enum of an uncopyable struct (#335), tuples holding a value struct (#320), trait-typed locals over pointer elements (#326), use-after-free assigning over a slot whose destructor reads it (#302)

Runtime and library

  • json: a dynamic JsonValue (#412), json.encode and json.decode for structs (#423), enums with values (#430), errors with line and column (#432), JSONC comments kept by json.parse_document (#434)
  • New modules: regex (RE2 syntax, linear time) (#347), cli option parsing (#361), digest (SHA-256, SHA-1, BLAKE3) (#368), compress (DEFLATE, zlib, gzip) and archive (tar) (#364), os (#348), process (#289), text (Utf8, Utf16, Ascii) (#254)
  • Map, Set and OrderedMap (#359); Handle and a -L library search option (#371)
  • io: Reader and Writer traits (#334), io.Print (#294), iterating a Directory and File.lines() (#322), TcpListener.incoming() (#332), io enums ErrorKind, SeekFrom, FileType, StdStream (#271)
  • Regex is [Shared] (#351); async.sleep(Duration) (#352)
  • Faster: value-struct hash table and hashing (#329), Array moves and swap (#337), constructing into empty slots (#419), no allocation on async and http hot paths (#264), io_uring as fast as epoll (#250), sharded live-allocation counter (#311), cancel flag read without a copy (#312)
  • Cleanup: modernized runtime code (#270), value enums in the async runtime (#269), shared socket code (#277), duplicate helpers removed (#233), refcount trace helpers removed and O(1) Array.clear for plain data (#286), Iterator.to_array workaround dropped (#328), IOCP address workaround dropped (#316), stray msvc.bat removed (#319)

Compiler and optimization

  • -O0 through -O3 with LLVM's pipeline (#257), link-time optimization at -O2/-O3 (#293), target CPU options (#299)
  • Debug info with -g: DWARF, CodeView and .pdb (#288)
  • Reference counting: steps inlined at call sites (#295) and folded by LLVM (#303)
  • memcpy, memmove and memset externs lower to LLVM intrinsics (#415)
  • Build cache: syntax trees kept per file (#219), canonical specialization (#296), the checked runtime cached (#305) and checked once per process (#304), passes skip it so imports are cheap (#431), fixes for string-constant order (#297) and module identity (#301)

Tooling and LSP

  • The language server analyzes in the background (#214), caches the runtime's syntax trees (#292), analyzes for the file's target OS (#290), resolves names sema leaves untyped (#300), and no longer panics after a non-ASCII character (#355)
  • VS Code dims code for other platforms (#284)
  • Apache 2.0 license; VSIX packaging warnings fixed (#278)

Docs and tests

  • Waiting on several sockets with tasks, channels and Select (#291); the tour's word counter uses String.split (#399); regenerated io-file reference (#418)
  • Shared integration-test helpers (#239), trimmed redundant tests (#407), LTO cache test accepts Apple's bitcode wrapper (#310)

CI and build

  • The gate passes on draft PRs (#343), requires test-linux (#314), no longer requires test-macos (#313, #404); the changes job is capped at 2 minutes (#346)
  • The version is 0.3.0 (#448)