Why’s it called “Pony”?

What makes Pony different?

Why would I use Pony instead of language X?

That’s a hard question to answer. Language X is probably very compelling for some problems. It’s probably less compelling for others. Such is computers. In the end, the best we can do is tell you what Pony is good at and you can make the decision for yourself. To learn more about Pony, we suggest checking out the “Discover” section of the website. There’s a portion of that section called “Why Pony” that might answer your question.

Where can I find the Pony roadmap?

There is no official roadmap. Pony is a volunteer driven project. Unlike many programming languages, we don’t have corporate backing. Our users add features and fix issues based on their needs. Pony users solve the problems that matter to them, and we all benefit.

Many of us who are regular contributors share some general goals as we move towards an official 1.0 release. We are working towards making Pony a stable, rock-solid platform for writing high-performance, concurrent applications.

We invite you to join our small but growing community and help push Pony forward. We’re still at an early stage, and new community members can have a huge influence on the language. Join us!

Code

How can I turn a ref into a val?

Generally, you can’t.

A ref may have any number of untracked mutable aliases, so it can’t be declared immutable. If you start with iso or trn instead, you can guarantee that by consuming it you are destroying the only mutable reference, hence allowing it to become immutable. See [the capabilities section of the tutorial] for more information

Similarly, a ref may sometimes be “lifted” to a val capability if it was created in the isolated region formed by a recover block, from which the compiler guarantees that no mutable references can leak. See the recover section of the tutorial for more information.

What does Foo() do if my Foo class has both create() and apply() methods? Does it call both?

How can I write code that works for every kind of Number in Pony?

If you want to support all kinds of numeric types for which Pony supports there are three ways to approach this problem:

Via Inheritance:

You pick the trait or interface that satisfies the operations you need from those numbers (e.g. support for sub is defined in trait val Real[A: Real[A] val]) and use this as a type or type parameter in Generics. This works fine for a lot of cases. But e.g. literal inference will not work here, as this example shows:

. Why is that? Literal inference only works for the built-in primitive types, but Integer[T] val could be extended by further not yet known classes.

Via Type Expressions:

There are plenty of pre-defined union types for all classes of numbers in Pony. E.g. type Signed is (I8 | I16 | I32 | I64 | I128 | ILong | ISize). There is also Unsigned, Int, Float and Number. Just pick what you need as your type.

But there is a problem with this approach. Not only do we state that T could be any element of Int. It could even be a combination of them. e.g. ( U8 | I16 ) and how you use t and T here must work for all possible instantiations of Int, that is every possible combination.

Via Type Expressions AND Inheritance:

To get rid of the literal inference problem and to make sure only single numeric types are accepted, not unions of them, in order to use the methods on the different integer types for our generic problem, we need to combine both the type unions and inheritance to get to a safe solution: (Int & Integer[T] val). The reason why this works is that Integer[T] val can only be instantiated by a single concrete Int element, so we get rid of the combinations and at the same time make the literal inference work as we lock our generic T down to single concrete types being part of Int:

As of Pony 0.17.0, if you are building ponyc from source, you can have --pic automatically set for you. When building ponyc, run the following make command and your generated ponyc binary will always supply --pic without you having to set it.

make default_pic=true

How do I fix ponyc reporting “unable to link” along with “undefined reference to SSL_*“?

By default, the Pony standard library uses OpenSSL 0.9 for various cryptography functions. This means if your OS has a non-default SSL library installed, you’ll have to let ponyc know. For example Arch Linux has OpenSSL 1.1 installed. On such a system, when compiling your application, add -Dopenssl_1.1.0 to the ponyc command:

ponyc -Dopenssl_1.1.0

You can compile Pony from source and set OpenSSL 1.1 as the default. Pass default_ssl=openssl_1.1.0 to the make command:

make default_ssl=openssl_1.1.0

By setting OpenSSL 1.1 as the default, you no longer have to pass -Dopenssl_1.1.0 to ponyc. Regardless of what version of OpenSSL was set as the default when you built Pony, you can always override it by using the appropriate define when compiling your Pony programs.

Make sure you’re running a cmd.exe/powershell.exe that does not include 32-bit VS environment variables.

This error occurs when ponyc is compiled in a 32-bit Visual Studio Developer Command Prompt.

Ecosystem

Does Pony have a package manager?

That would be yes and no. Package manager means different things to different people. What we have is a simple dependency manager called pony-stable that we are planning on growing into a full featured tool. Whether that is a more full featured “dependency manager” or more full featured “package manager” depends on how you define the two terms.

Linking

How can I supply custom linker parameters?

So, you need to link your program to a custom library or otherwise pass a particular linker option? You can accomplish your goal using the ponyc--linker option.

You’ll need to know what your current linker is. To get it, compile a pony program and pass --verbose 3.

The path ending in link.exe is the linker that the pony compiler is currently using.

To add options to the link command, I would compile my program as something like:

ponyc --linker="C:\OtherPath\link.exe /LIBPATH:C:\Foo"

Runtime

Does Pony have green threads?

The short answer is no. Pony doesn’t have green threads. By default, the Pony scheduler starts 1 “actor thread” per available CPU. These threads are used to schedule actors. Each of these threads is a kernel thread.

The longer answer is “it depends”. Actors are Pony’s unit of concurrency and many people when asking if Pony has green threads really are asking about how concurrency is modeled. You, as a Pony programmer, never interact with scheduler threads directly, you never interact with any sort of thread. You worry about actors and sending messages between them.