Skip to content

Releases: ponylang/ponyc

0.19.2

24 Sep 19:06
Compare
Choose a tag to compare

Pony 0.19.2 features a high priority fix for a bug in Pony serialization. Before 0.19.2, serialising an empty string would cause a segmentation fault.

Fix empty string serialisation

The Pony 0.15.0 release introduced a bug in Pony serialization. From Pony 0.15.0 to 0.19.1 the following code would cause a segfault:

use "serialise"

actor Main
  new create(env: Env) =>
    try
      let auth = env.root as AmbientAuth
      Serialised(SerialiseAuth(auth), "")?
    end

RFC #46 implemented

Pony 0.19.2 also includes the implementation of RFC #46: More random methods.
The following methods were added to the Random trait, similar to the existing u8, u16, u32, u64, and u128 methods:

  fun ref ulong(): ULong =>
    """
    A random integer in [0, ULong.max_value()]
    """

  fun ref usize(): USize =>
    """
    A random integer in [0, USize.max_value()]
    """

  fun ref i8(): I8 =>
    """
    A random integer in [-2^8, 2^8)
    """

  fun ref i16(): I16 =>
    """
    A random integer in [-2^16, 2^16)
    """

  fun ref i32(): I32 =>
    """
    A random integer in [-2^32, 2^32)
    """

  fun ref i64(): I64 =>
    """
    A random integer in [-2^64, 2^64)
    """

  fun ref i128(): I128 =>
    """
    A random integer in [-2^128, 2^128)
    """

  fun ref ilong(): ILong =>
    """
    A random integer in [ILong.min_value(), ILong.max_value()]
    """

  fun ref isize(): ISize =>
    """
    A random integer in [ISize.min_value(), ISize.max_value()]
    """

Additionally, the existing int method of the Random trait was updated to allow specifying the integer type as a type parameter, instead of only supporting the U64 type:

  fun ref int[N: (Unsigned val & Real[N] val) = U64](n: N): N =>
    """
    A random integer in [0, n)
    """

The array-oriented shuffle method was added to the Random trait.

  fun ref shuffle[A](array: Array[A]) =>
    """
    Shuffle the elements of the array into a random order, mutating the array.
    """

To support Random.shuffle, the swap_elements was added to the Array class (because otherwise, it is not possible to swap two elements in place without aliasing them):

  fun ref swap_elements(i: USize, j: USize) ? =>
    """
    Swap the element at index i with the element at index j.
    If either i or j are out of bounds, an error is raised.
    """

[0.19.2] - 2017-09-24

Fixed

  • Fix codegen failure on field access (PR #2244)
  • Make Windows link step use the command-line --linker value if present. (PR #2231)
  • Fix empty string serialisation (PR #2247)

Added

  • Added Array.swap_elements, Random.shuffle and extends Random with methods for generating all Integer types (RFC 46). (PR #2128)

0.19.1

14 Sep 01:30
Compare
Choose a tag to compare

Pony 0.19.1 has no breaking changes and fixes no high-priority bugs, so you can update at your leisure.

Lambda and Array Inference

This release includes significant improvements to type inference for array literals and lambda expressions when the type of the expression has an unambiguous antecedent (such as the "left side" of an assignment, the parameter signature of a method call, or the return type of a method body), including the following improvements:

  • Empty array literals are now valid syntax: let a: Array[U8] = []
  • Non-homogenous concrete elements in an array literal can be treated as a trait or interface instead of as a union: let a: Array[Stringable] = [true; None; "string"]
  • Array literals can have an implied capability recovery to iso or val: let a: Array[String] val = ["foo"; "bar"; "baz"]
  • Lambda expressions can have implied parameter and return types: let fn: {(U64, U64): U64} = {(x, y) => x + y }
  • Unused lambda parameters can use the "don't care" symbol (_) instead of a parameter name and type: let fn: {(U64, U64): U64} = {(_, y) => y * 2 }
  • The receiver and object capability of lambda expressions can be inferred from context, instead of being inferred from the statefulness of the lambda.

For more information, see RFC #45.

[0.19.1] - 2017-09-14

Fixed

  • Fix broken "make" command (PR #2220)
  • Fix inconsistencies in multi-line triple-quoted strings (PR #2221)
  • Fix undersized string buffer for library link command in Windows. (PR #2223)
  • Fix Iter.take to handle infinite iterator (PR #2212)
  • Fix handling of empty and multi-byte character literals (PR #2214)

Added

  • Inference of lambda type and array element type from an antecedent (RFC 45). (PR #2168)

0.19.0

02 Sep 13:10
Compare
Choose a tag to compare

Pony 0.19.0 contains breaking changes. If you don't use the Itertools package then upgrading should be painless. If you do use Itertools, the process should be relatively straightforward. MacOS, FreeBSD and Dragonfly BSD users are recommended to upgrade as soon as possible to fix a race condition on the kqueue event system.

Improve the Itertools API

The implementation of RFC #49 makes many changes to the itertools package. The first significant change is that all classes other than Iter have been removed. All of these classes have had equivalent functions in the Iter class, the exception being Repeat, which is now handled by the repeat_value constructor. So, for example, Repeat[String]("a") should be replaced by Iter[String].repeat_value("a").

Another significant change is that fold has become non-partial and has had its arguments switched so that the lambda is placed last. For example:

let sum =
  try  
    Iter[I64]([1; 2; 3].values())
      .fold[I64]({(sum: I64, n: I64): I64 => sum + n }, 0)?
  else
    I64(0)
  end

Should be replaced by

let sum =
  Iter[I64]([1; 2; 3].values())
    .fold[I64](0, {(sum: I64, n: I64): I64 => sum + n })

If the lambda argument to fold needs to be partial, then you should use the new fold_partial method.

Other methods have been added to the Iter class such as flat_map, filter_map, as well as methods that allow lambdas with ref receivers for stateful transformations. These methods have a "_stateful" suffix, such as map_stateful and filter_stateful.

Fix signals on Sierra

MacOS Sierra changed how signals are delivered to multithreaded processes. Pony's signal handling has been broken on Sierra since it was introduced. It's now fixed as Sylvan and Sean finally sat down to figure out what was going on.

[0.19.0] - 2017-09-02

Fixed

  • Fix codegen failures on incompatible FFI declarations (PR #2205)
  • Disallow named arguments for methods of a type union where parameter names differ (PR #2194)
  • Fix compiler crash on illegal read from '_' (PR #2201)
  • Fix signals on Sierra (PR #2195)
  • Fix race condition in kqueue event system implementation (PR #2193)

Added

  • pony_chain runtime function

Changed

  • The pony_sendv and pony_sendv_single runtime functions now take a message chain instead of a single message
  • Improve the itertools API (RFC 49) (PR #2190)
  • Forbid struct finalisers (PR #2202)

0.18.1

25 Aug 00:14
Compare
Choose a tag to compare

Pony 0.18.1 contains a high priority bug fix in the ProcessMonitor package. We recommend upgrading as soon as possible. There are no breaking changes in this release.

Process monitor async write buffering

Before this release, it was easy to swamp an external process started by the ProcessMonitor with too many writes. Excessive writes would result in errors and lost data. 0.18.1 adds write buffering thereby avoiding lost data.

DragonFly BSD 4.8 support

Pony has been ported to support DragonFly BSD 4.8. Note, we do not have CI for DragonFly, so support is provided on a "best-effort" basis. That is, we won't intentionally break support, but we also aren't actively testing commits against DragonFly so some breakage can be expected.

[0.18.1] - 2017-08-25

Fixed

  • Don't print capabilities for type params when generating docs (PR #2184)

Added

  • DragonFly BSD 4.8 support (PR #2183)
  • Process monitor async write buffering (PR #2186)

0.18.0

19 Aug 14:38
Compare
Choose a tag to compare

Pony 0.18.0 contains a high priority compiler bug fix. We recommend updating as soon as possible. Note, however, that there is a small breaking change in this release as well. It should be a quick upgrade if you are impacted.

Fix compiler crash on union-of-tuples to tuple conversions

Previously, when trying to compile a union-of-tuples, the compiler would segfault. Very annoying if you had a reasonable program like:

primitive Add
primitive Dec
type AddOrDec is (Add | Dec)
type CmRDTCounterOp is (AddOrDec, U128)

class CmRDTCounter
  var _value: U128

  new create() => _value = 0

  fun read(): U128 =>
    _value

  fun ref add(number: U128): CmRDTCounterOp =>
    let op: CmRDTCounterOp =
      if number >= 0 then
        (Add, number)
      else
        (Dec, number)
      end
    apply(op)
    op

  fun ref apply(op: CmRDTCounterOp) =>
    match op
      | (Add, let number: U128) => _value = _value + number
      | (Dec, let number: U128) => _value = _value - number
    end

actor Main
  new create(env: Env) =>
    var counter = CmRDTCounter.create()
    let op1 = counter.add(10)

If you are interested in learning more, we suggest checking out issue #1513 for a bit more background and listen to the August 16, 2017, Pony development sync call where we discussed it in depth.

Change String.join to take Iterable

0.18.0 includes the implementation of RFC #48. It's a nice improvement to the usability of String.join. It is also, sadly, a breaking change. Such is life. Sometimes you break things to improve them. Upgrading should be straightforward.

Where you previously called "_".join(["zomg"]), you would now call "_".join(["zomg"].values()). Any place you hit a compiler error related to String.join, add a .values() to the ReadSeq you are passing and everything will work.

[0.18.0] - 2017-08-19

Fixed

  • Fix compiler crash on union-of-tuples to tuple conversions (PR #2176)
  • Fix compiler error on lambda capture of '_' (PR #2171)
  • Fix read past the end of a buffer in pool.c. (PR #2139)

Changed

  • Make actor continuations a build time option (PR #2179)
  • RFC #48 Change String.join to take Iterable (PR #2159)
  • Change fallback linker to "gcc" from "gcc-6" on Linux. (PR #2166)
  • Change the signature of pony_continuation and pony_triggergc to take a pony_ctx_t* instead of a pony_actor_t*.

0.17.0

05 Aug 20:32
Compare
Choose a tag to compare

Pony 0.17.0 is a recommended release if you are using GCC 7 on Linux. Before this release, GCC 7 was unable to build the Pony compiler. If you aren't using GCC 7, you can take your time upgrading. Please note, there is a breaking change in this release, but it's quite unlikely that anyone will be impacted by it.

Treat as type of array literals as the alias of the element type

Previously, an array literal, even when the as type is given explicitly, uses the alias of the as type as the type argument for the Array type. For example:

trait iso T
class iso A is T
class iso B is T
class iso C is T

actor Main
  new create(env: Env) =>
    let a: T = A
    let b: T = B
    let c: T = C
    let abc: Array[T] = [as T^: A; B; C] // works
    let abc': Array[T] = [as T: A; B; C] // fails: literal has type Array[T!]

We doubt that anyone currently has the `// works`` line anywhere in their code. However, if you are impacted, update it to:

let abc': Array[T] = [as T: A; B; C]

default_pic build option

Previously on platforms that required PIC, you would have to pass the --pic flag to ponyc each time you compiled a Pony program. With the addition of default_pic, you can build ponyc so that --pic is automatically handled for you. Use make default_pic=true when building ponyc and away you go!

[0.17.0] - 2017-08-05

Fixed

  • Fix cursor location for displaying compiler errors and info. (PR #2136)
  • Fix indent detection when lexing docstrings that contain whitespace-only lines. (PR #2131)
  • Fix compiler crash on typecheck error in FFI call. (PR #2124)
  • Fix compiler assert on match including structural equality on union type. (PR #2117)

Added

  • Support GCC7 on Linux (PR #2134)
  • Add regex match iterator (PR #2109)
  • Add more promise methods (RFC 35) (PR #2084)
  • Add ability to default enable PIC when compiling ponyc (PR #2113)

Changed

  • Treat as type of array literals as the alias of the element type. (PR #2126)
  • docgen: ignore test types and add cli flag to only document public types (PR #2112)

0.16.1

30 Jul 01:52
Compare
Choose a tag to compare

Pony 0.16.1 is a quick follow on release to 0.16.0. After releasing 0.16.0, we closed out a couple high priority bugs. Upgrading as soon as possible is recommended. If you haven't upgraded to 0.16.0, check out it's release notes before starting your upgrade.

[0.16.1] - 2017-07-30

Fixed

  • Fix reachability analysis for intersection types (PR #2106)
  • Fix compiler assertion failure at code generation (PR #2099)
  • FreeBSD builds(PR #2107)

0.16.0

28 Jul 18:46
Compare
Choose a tag to compare

Pony 0.16.0 is an awesome step forward but its also going to be a painful step forward. 0.16.0 features the implementation of the "Explicit partial calls" RFC. It is going to break almost every single Pony codebase out there. There are no high priority bug fixes in this release so, you can take your time upgrading.

Explicit partial calls

In Pony 0.16.0, we've introduced a breaking syntax change that affects all
calls to partial functions (functions that can raise an error).

All partial function calls are now required to be followed by a question mark.

For example, iterator.next() is now iterator.next()?, providing a visual
indication at the call site of any places where an error may be raised.

Call sites to partial functions that fail to include the question mark
will result in a compiler error that looks like this:

  /tmp/test.pony:5:19: call is not partial but the method is - a question mark
  is required after this call
      iterator.next()
                    ^
      Info:
      /tmp/ponyc/packages/builtin/array.pony:578:24: method is here
        fun ref next(): B->A ? =>
                             ^

See the RFC for more details: https://github.com/ponylang/rfcs/blob/master/text/0039-explicit-partial-calls.md

As you might imagine, this change will affect nearly every Pony codebase,
so we want to provide support for developers who are making this transition.

We've created migration scripts for the convenience of developers making the
transition. These scripts can ingest Pony compiler errors in the format emitted
by ponyc to STDERR and make the necessary modifications to the Pony source code
files that caused the errors, adding the question mark wherever it is needed
for compliance with the new syntax requirement.

If you need any other assistance with this transition, please reach out to
us. We're here to help!

[0.16.0] - 2017-07-28

Fixed

  • Fix compiler assertion failure on unused reference to _ (PR #2091)
  • Destroy all actors on runtime termination (PR #2058)
  • Fixed compiler segfault on empty triple quote comment. (PR #2053)
  • Fix compiler crash on exhaustive match where last case is a union subset (PR #2049)
  • Make pony_os_std_print() write a newline when given empty input. (PR #2050)
  • Fix boxed tuple identity when type identifiers differ (PR #2009)
  • Fix crash on interface function pointer generation (PR #2025)

Added

  • Alpine Linux compatibility for pony (PR #1844)
  • Add cli package implementing the CLI syntax (RFC #38)
    • Initial (PR #1897) implemented the full RFC and contained:
      • Enhanced Posix / GNU program argument syntax.
      • Commands and sub-commands.
      • Bool, String, I64 and F64 option / arg types.
      • Help command and syntax errors with formatted output.
    • Update (PR #2019) added:
      • String-seq (ReadSeq[String]) types for repeated string options / args.
      • Command fullname() to make it easier to match on unique command names.
      • Checking that commands are leaves so that partial commands return syntax errors.

Changed

  • Forbid returning and passing tuples to FFI functions (PR #2012)
  • Deprecate support of Clang 3.3
  • Explicit partial calls - a question mark is now required to be at the call site for every call to a partial function.
    • See RFC 39.
    • Migration scripts for user code, for convenience, are provided here:

0.15.0

08 Jul 08:27
Compare
Choose a tag to compare

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.

[0.15.0] - 2017-07-08

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)

0.14.0

06 May 10:08
Compare
Choose a tag to compare

0.14.0 closes many high priority bugs across all platforms. You should upgrade as soon as possible. This is a breaking release. You will need to update your code.

PR #1886 which fixes 3 "garbage collection" bugs. They were not, however, garbage collection bugs. This problem was a single error in the hashmap implementation that underlies much of the Pony runtime. Interested in learning more about the Pony runtime? The commit comment for the PR makes for interesting reading.

This release also includes RFC #23.
RFC #23 changes the Pony standard library to force the implementation of network error handling code. From the RFC motivation:

Prevent Pony users from creating "silent failure" scenarios with their network code. TCPConnectionNotify, UDPNotify, and TCPListenNotify will all, by default, silently eat connection failures.

When you are upgrading, if you have any code that uses TCPConnectionNotify, UDPNotify, or TCPListenNotify and you didn't implement:

  • TCPConnectionNotify.connect_failed
  • UDPNotify.not_listening
  • TCPListenNotify.not_listening

You will be required by the compiler to implement them. Adding something like:

fun ref connect_failed(conn: TCPConnection ref) =>
  """
  Intentionally ignoring the connection failing!
  WHEEEEEEEEEE! YOLO! Data loss is going to occur. ¯\_(ツ)_/¯
  """
  None

will get you the previous "silently eat errors" behavior. But, at least this time, you'll be doing it intentionally.

[0.14.0] - 2017-05-06

Fixed

  • Compiler error instead of crash for invalid this-dot reference in a trait. (PR #1879)
  • Compiler error instead of crash for too few args to constructor in case pattern. (PR #1880)
  • Pony runtime hashmap bug that resulted in issues #1483, #1781, and #1872. (PR #1886)
  • Compiler crash when compiling to a library (Issue #1881)(PR #1890)

Changed

  • TCPConnection.connect_failed, UDPNotify.not_listening, TCPListenNotify.not_listening no longer have default implementation. The programmer is now required to implement error handling or consciously choose to ignore. (PR #1853)