What is pony programming language
Pony is a type of programming language that allows you to “write, then run”. It was started by some really smart and ambitious people who wanted to make programming more approachable and less intimidating. The goal of this tutorial post is to show you how easy it is to learn Pony (it takes less than an hour), so you are able to write random code without any explicit knowledge on the subject. If you want the whole story behind Pony, go check out the website! For now, I’ll focus on the language itself.
First of all, Pony is a whitespace-oriented language. This means that there are no curly andbrace characters (the brackets to denote variables/functions), and whitespaces can be used to delimit lines. For example:
def do_something ( value ) end do_something( 1 ) do_something( 2 ) do_something( 3 ) do_something( 4 ) do_nothing()
You’ve probably noticed that this is the opposite of what you normally see in most other languages. I strongly suggest to change your editor settings to view the file with 4 spaces per indentation level.
The first thing you will notice is that this program doesn’t actually do anything. It just displays four blank lines. This means that a simple “Hello, World!” program would look like this:
def main () end main()
How to get started with pony programming language
Pony is an open-source programming language, and the official website is here: [link](https://github.com/ponylang/Pony). There are a few ways to install it on your computer, depending on the operating system you are using. It’s important to know that Pony was not developed by some big company or with big budgets, and it’s built by only five people (three of them being in my current class). So chances are you can get it for free! If you feel like contributing and helping to improve it, you can find a lot of great resources on their wiki: [link](https://github.com/ponylang/Pony/wiki).
You can use Pony for the following:
Web Development (yes, it does work for the web!)
Network Programs (think of a system program, like an operating system)
Distributed and Parallel Computing
Game Development (yes, games too!)
Research or Education (if you are a researcher or student)
►Quick Start Guide●1. Install ponyc●2. Write your first program●3. Make sure you read the documentation●4. Open source it!
To install ponyc, you can download it from GitHub:
$ curl -L https://github.com/ponylang/Pony/archive/master.zip > ponyc-master.zip $ unzip ponyc-master.zip
The -master is to ensure you download the latest version. Also, you can read the instructions from the official website. After you installed it, you should be able to run “ponyc -v” and see that ponyc was successfully installed.
Advantages of using pony programming language
The main advantage of Pony is that you get to see your code run the second you type it. This makes it ideal for educational purposes, where students can experiment with code and actually see how it works. The fact that everything is an object also helps people understand what they are looking at, which in turn leads to better-organized and more powerful code. And since it is a compiled language, the background compiler can check for common programming errors, such as null pointer dereferencing.
Another great advantage of Pony is its speed. While not being the fastest language out there, it is still one of the fastest around and even allows for parallelism during execution. But at the same time, this also means that Pony programs are inherently complex and require certain conditions to be met before they run.
Lastly, the Pony compiler is fully open source and available on GitHub. This means that anyone willing can study it and even contribute to its development.
Examples of code in pony programming language
Now it’s time to get your hands dirty! To create a new program, you will have to run the following command in the console: “ponyc”. After that, you can choose which file you want to enter your code into: “new” for a new file, “edit” for an existing one, or “save” to save the changes you made to your previous code. You will then have a blank file in which you can start typing your code. Make sure that it sticks to Pony’s syntax guidelines and it will be valid when you are done!
Here are some basic features of Pony’s syntax:
* Comments begin with double-slash “//” and end at the end of the line.
* Statements must be terminated with a semicolon.
* You can have multiple statements on one line by separating them with a comma (if they all evaluate to unit).
* Some special keywords (such as “class”, “object”, “end”, etc.) are case-sensitive.
* The following keywords can be used as variables: “self”, “this”, and “@type”.
* The following keyword is the name of a variable: “string”.