0.22.0 Released

Thursday, May 24, 2018 | Posted in Release

Pony 0.22.0 is a recommended update. It’s a large update as we ended up not releasing on our normal monthly schedule. There are some stability fixes as well as a variety of other changes. This release includes breaking changes and will probably require you to update your code.

Please note, due to some issues when releasing, we will be doing 0.22.1 release in the next day that will have no changes. It’s solely to get an official Docker image built for this release.

Make digestof and hash() return USize instead of U64 and add hash64()

The Hashable interface now requires objects to provide a hash() function returning USize instead of U64. If some of your types provide hash(), you should change the return type and modify the implementation accordingly. A Hashable64 interface requiring a hash64() function returning U64 is now available.

Forbid impossible pattern matching on generic capabilities

Pattern matching on generic capabilities is now prohibited. This means that code like the following example won’t compile anymore.

fun foo[A: Any #send](a: A) =>
  match a
  | let a': Any val => print("val")
  else
    print("other")
  end

iftype should be used as a replacement.

fun foo[A: Any #send](a: A) =>
  iftype A <: Any val then
    print("val")
  else
    print("other")
  end

New Ponybench API

The ponybench micro-benchmarking framework has changed to have more flexible configuration and produce more detailed statistics. The API now resembles that of the ponytest package and has a greater distinction between synchronous and asynchronous benchmarks. The new framework now provides the option to output CSV with the -csv flag. The CSV output may be used to create box plots, histograms, and other visual representations of the benchmark data. Details of how to use the new API are available in the package documentation.

Expose OutStream rather than StdStream in Env

Previously Env.out and Env.err were of the type StdStream. This worked fine but didn’t make for easy testing of output. Env.out and Env.err are now of type OutStream which is an interface rather than a concrete type. By making Env expose and rely on the OutStream interface, it is possible to create mock environments for testing. For example, one can implement an OutStreamStringAccumulator that accumulates output to a String that can then be checked in a unit test. Updating your code is straightforward. Change StdStream to OutStream for anything where you got the StdStream from Env.

Allow more customization of artificial environments

In the same realm of “Expose OutStream rather than StdStream in Env,” we made artificial Env instances even more customizable, which are mostly used for testing. It is now possible to “mock” both Env.input representing stdin and intercept setting the exit code via Env.exitcode.

Env.input used to be of type Stdin which didn’t allow easy mocking, now it is the interface InputStream which is easily implemented for testing. Stdinused to require a StdinNotify to receive stdin data to the application. In order to stay consistent with the new InputStream StdinNotify has been renamed to InputNotify.

Rename Date to PosixDate

TheDate class has been renamed to PosixDate to better reflect that it is not a full grown date class that handles all corner cases, timezones, calendars. It is implemented after the POSIX tm struct. Its API stayed the same with the exception that now if provided with negative constructor parameters it will coalesce them to 0 to avoid creating invalid dates by accident.

Add SourceLoc.type_name method, showing the name of the containing type

The SourceLoc interface is used for representing a location in Pony source code, filled in automatically by the compiler when using the __loc keyword. A type_name function has been added to this interface, and the method function has been renamed as method_name for consistency. Any Pony code that was using SourceLoc and/or __loc objects to print the name of a method will need to be updated with this name change. They will also now have the type_name available to print if they so choose.

Changelog

Fixed

  • Incorrect rstrip handling of multibyte characters (PR #2706)
  • Fix File.flush return value for case of zero bytes to flush. (PR #2704)
  • Enable virtual terminal color output on Windows. (PR #2702)
  • Compute File.writeable based on FileWrite instead of FileRead. (PR #2698)
  • Do not use llvm.smul.with.overflow.i64 anymore (PR #2693)
  • Change directory.open_file() to use readonly open (PR #2697)
  • Avoid flattening arrow to type param, fixing typechecking when reified with another type param. (PR #2692)
  • Fix File.valid() and clarify File behavior in error cases (PR #2656)
  • Fix tuple pattern matching issue where only some elements would violate caps. (PR #2658)
  • Fix scheduler suspend edge case assertion (PR #2641)
  • Fix code generation failure with tuples in recover blocks (PR #2642)
  • Do not mute sender if sender is under pressure (PR #2644)
  • Fix FilePath.walk performance issues (issue #2158). (PR #2634)
  • Fix backpressure-related TCPConnection busy-loop bug (issue #2620). (PR #2627)
  • Fix off-by-one error in String.cstring (PR #2616)
  • Fix compiler crash related to array inference. (PR #2603)
  • Ensure ASIO thread cannot be stopped prematurely (PR #2612)
  • Handle EAGAIN errors on socket operations (PR #2611)
  • Properly report type parameter capability errors (PR #2598)
  • Update the Windows build to support the latest Visual C++ Build Tools (PR #2594)
  • Fix tracing of boxed tuples through interfaces (PR #2593)
  • Partially mitigate LLVM’s infinite loops bug (PR #2592)
  • Fix extracting docstring from constructors (PR #2586)
  • Always unsubscribe process_monitor fds before closing them (#2529) (PR #2574)
  • Fix two race conditions where an ASIO wakeup notifications can be lost (PR #2561)
  • Fix compiler crash in alternate name suggestion logic (issue #2508). (PR #2552)
  • Make the File.open constructor use read-only mode (Issue #2567) (PR #2568)
  • Correctly typecheck FFI arguments with regard to aliasing (PR #2550)
  • Allow tuples to match empty interfaces (PR #2532)
  • Properly report default argument inference errors (PR #2504)
  • Do not catch foreign exceptions in Pony try blocks. This still doesn’t work on Windows, foreign code doesn’t catch foreign exceptions if they’ve traversed a Pony frame. (PR #2466)
  • Fix LLVM IR verification with DoNotOptimise (PR #2506)

Added

  • Add addc, subc and mulc functions to I128 and U128 (PR #2645)
  • Add mechanism to register (noisy) signal handler (PR #2631)
  • Added nosupertype annotation for subtyping exclusion (RFC 54). (PR #2678)
  • SourceLoc.type_name method (PR #2643)
  • Update with experimental support for LLVM 6.0.0 (PR #2595)
  • Improve pattern matching error reporting (PR #2628)
  • Allow recovering at most one element of a tuple to mutable capability. (PR #2585)
  • Add full’ish support for network socket get & set options (PR #2513)
  • Add basic compiler plugins (PR #2566)
  • [RFC 50] add member docstrings (PR #2543)
  • Allow user defined help string at CommandSpec.add_help() (PR #2535)
  • Embed source code into generated documentation. (PR #2439)
  • Compile error when comparing sugared constructors with ‘is’ or ‘isnt’ (#2024) (PR #2494)
  • Support OpenSSL 1.1.0 (PR #2415)
  • Add U64 type to cli package. (PR #2488)
  • Allow customisation of Env.input and Env.exitcode in artificial environments
  • hash64() function and related helper types in collections for 64-bit hashes (PR #2615)

Changed

  • SourceLoc.method renamed as SourceLoc.method_name method (PR #2643)
  • New Ponybench API (RFC 52) (PR #2578)
  • Forbid impossible pattern matching on generic capabilities (PR #2499)
  • Remove case functions (PR #2542)
  • Rename Date to PosixDate (PR #2436)
  • Fix and re-enable dynamic scheduler scaling (PR #2483)
  • Expose OutStream rather than StdStream in Env (PR #2463)
  • Rename StdinNotify to InputNotify
  • digestof and hash() now return USize instead of U64 (PR #2615)

AUTHOR

Sean T. Allen

Sean is a member of the Pony core team. His turn-ons include programming languages, distributed computing, Hiwatt amplifiers, and Fender Telecasters. His turn-offs include mayonnaise, stirring yogurt, and sloppy code. He is one of the authors of Storm Applied, and VP of Engineering at Wallaroo Labs.