0.15.0 Released

Saturday, July 08, 2017 | Posted in Release

Pony 0.15.0 closes some high priority bugs across all platforms. Upgrading as soon as possible is highly recommended. Please note, this release contains breaking changes and might require code updates on your part.

Exhaustive match

It’s one of the most requested features for Pony, and it’s finally arrived. Previously the Pony compiler didn’t do exhaustiveness checking for matches which meant you always had to have a else None clause. Depending on the situation, this ranged from mildly annoying to exceedingly aggravating. Now instead of having code like:

fun my_fun(a: (String | U64)) =>
  match a
  | let x: String => "something"
  | let y: U64 => "something else"
  else None
    "ugh this sucks"
  end

We have the much more pleasing:

fun my_fun(a: (String | U64)) =>
  match a
  | let x: String => "something"
  | let y: U64 => "something else"
  end

It should be noted that there is currently an open bug related to exhaustive match. If you start taking advantage of exhaustive match, be aware that you might be impacted. Expect a fix in the near future and a new release once that fix lands.

Thanks, Joe McIlvain for bringing this one home.

Custom object serialization

Pony now includes support for custom serialization mechanisms. See RFC #21 for full details. Big thanks to Andrew Turley and the folks at Sendence for this enhancement to Pony serialization.

C API callback support

You can now interoperate with C APIs that requires function callbacks thanks to the newly added “bare lambdas” feature. There are some C libraries that were impossible to work with before this change. We now have a much better C-FFI story to tell. Thanks go out to Benoit for implementing this RFC.

New persistent collections types

Theo Butler added two new persistent collections types (Vector and Set) to the standard library. Thanks Theo for your work pushing the persistent collections classes forward.

Time.wall_to_nanos is no more

If you were previously using Time.wall_to_nanos and you inspected the values you were getting from it; you might have noticed that they weren’t particularly “sensible.” One would expect the nanosecond value returned to be the number of nanoseconds since “the beginning of time.” However, it wasn’t. Time.wall_to_nanos has been removed from the standard library and replaced with Nanos.from_wall_clock. If you need to convert a wall clock time into a nanosecond timestamp since “the beginning of time,” this is your function. Code that was previously:

use time

fun my_time_thing() =>
  Time.wall_to_nanos(Time.now())

should be updated to be:


use time

fun my_time_thing() =>
  Nanos.from_wall_clock(Time.now())

Machine word constructors no longer have a default argument

Honestly, this breaking change shouldn’t be a breaking change for anyone. If it is, you are doing something pretty special. This change fixes some issues with comparing machine words using the is keyword. Full details can be seen in the PR.

iftype syntax update

We recently introduced a new iftype syntax. After it was released, we decided that the keywords introduced for it were less than optimal. With this change, the elseiftype keyword is removed and replaced with elseif. This is a breaking change but, given the newness of iftype, we doubt it impacts on anyone yet.

Fixed

  • Fix bug in as capture (PR #1981)
  • Fix assert failure on lambda parameter missing type. (PR #2011)
  • Fix iftype where the type variable appears as a type parameter. (PR #2007)
  • Fix support for recursive constraints in iftype conditions. (PR #1961)
  • Fix segfault in Array.trim_in_place (PR #1999)
  • Fix segfault in String.trim_in_place (PR #1997)
  • Assertion failure with directly recursive trait (PR #1989)
  • Add compile error for generic Main (PR #1970)
  • Prevent duplicate long_tests from being registered (PR #1962)
  • Assertion failure on identity comparison of tuples with different cardinalities (PR #1946)
  • Stop default arguments from using the function scope (PR #1948)
  • Fix compiler crash when a field is used in a default argument. (PR #1940)
  • Fix compiler crash on non-existent field reference in constructor. (PR #1941)
  • Fix compiler crash on “_” as argument in a case expression. (PR #1924)
  • Fix compiler crash on type argument error inside an early return. (PR #1923)
  • Correctly generate debug information in forwarding methods (PR #1914)
  • Resolved compiler segfault on optimization pass (issue #1225) (PR #1910)
  • Fix a bug in finaliser handling (PR #1908)
  • Fix compiler crash for type errors in call arguments inside a tuple. (PR #1906)
  • Fix compiler crash involving “dont care” symbol in an if or try block. (PR #1907)
  • Don’t call TCPConnection backpressure notifies incorrectly (PR #1904)
  • Fix outdated methods in persistent.Map docstring. (PR #1901)
  • Fix format for number types (issue #1920) (PR #1927)

Added

  • Make tuples be subtypes of empty interfaces (like Any). (PR #1937)
  • Add Persistent Vec (RFC 42) (PR #1949)
  • Add support for custom serialisation (RFC 21) (PR #1839)
  • Add persistent set (RFC 42) (PR #1925)
  • Bare methods and bare lambdas (RFC 34) (PR #1858)
  • xoroshiro128+ implementation (PR #1909)
  • Exhaustive match (RFC #40) (PR #1891)
  • Command line options for printing help (PR #1899)
  • Nanos.from_wall_clock function to convert from a wall clock as obtained from Time.now() into number of nanoseconds since “the beginning of time”. (PR #1967)

Changed

  • Change machine word constructors to have no default argument. (PR #1938)
  • Change iftype to use elseif instead of elseiftype as next keyword. (PR #1905)
  • Removed misleading Time.wall_to_nanos. (PR #1967)

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 Enginerring at Wallaroo Labs.