Ferret is an evented, objective hobby programming language.



All functions and methods in Ferret are implemented as events.

This means that for every named function or method, any number of callbacks may be hidden behind it, each of which accepts its own arguments and spits out its own return values. This makes it really easy to extend existing code without breaking things.


Ferret features a unique inheritance system in which all values are objects, each of which can inherit from any number of other objects.


Ferret's transparent runtime makes it easy to manage I/O, timers, asynchronous operations, and more – all without implementing your own event loop.

If asynchronous operations are occurring at any given moment, a Ferret program continues processing until those operations are complete. Ferret also effortlessly makes use of system-optimized polling methods for I/O.

delay(5) {
    say("it's been five seconds!")    
say("starting timer...")


Ferret currently compiles exclusively to Perl, a high-level language. It might therefore be classified as a very-high-level language (VHLL). In other words, Ferret has many novel features, often at the cost of considerable overhead.

say("Hello World!")


While Ferret is a compiled language, its compiler and runtime are both written in an interpreted language. On top of that, the standard library provides an interface to the compiler. This allows Ferret to offer some features of interpreted languages such as compilation and evaluation during runtime.

$code = "4.sqrt"
$two = COMPILER($code).eval().result

Getting started



Ferret requires the following Perl modules from the CPAN:

cpanm File::Slurp IO::Async Getopt::Long::Descriptive Data::Dump Perl::Tidy Types::Serialiser JSON::XS DateTime

The following core modules are also required but are likely already present on your system. If an error mentions any of them, you may need to upgrade them to their latest versions.

cpanm File::Find File::Basename Scalar::Util List::Util FindBin Carp POSIX Exporter


After cloning the repository, Ferret requires a configuration. It's truly as simple as specifying where on your system the repository exists.

Using a systemwide configuration

Copy ferret.conf.example to /etc/ferret.conf. In it, set the $ferret_root variable to the absolute path of this repository.

sudo cp ferret.conf.example /etc/ferret.conf

Make sure that all users have read permission.

sudo chmod 755 /etc/ferret.conf

After that, try running the compiler from the repository root directory to compile the standard library.


Configuration elsewhere

If you cannot write to /etc/ferret.conf, you can store your configuration elsewhere. Just set the environment variable $FERRET_CONFIG to the absolute path of your configuration file. To set it semi-permanently, add it to your ~/.bash_profile or the like.

export FERRET_CONFIG="/path/to/my/ferret.conf"


Once you have the compiler working, you're ready to write some code. The easiest way is to make a sandbox directory within this repository tree. Name your files with .frt. Then compile.


Compile with the ferret executable, passing file paths as arguments. If no file paths are provided, it searches the current directory and all subdirectories for .frt and .frtdoc files. Unchanged files are ignored. See ./ferret -h for all flags. The entire standard library is compiled like so:


After updating the repository, the compiler may have changed. You might want to run ferret with the -n flag to force all source files to recompile.

./ferret -n


Run files with the -r flag:

./ferret -r test/1-hello-world.frt

You can also run Ferret files directly if they are executable and include the hashbang #!/usr/bin/env ferret -r (assuming the ferret bin is in your PATH):

cd test/35-irc-new


There are bugs. There is much work to be done. Some problematic scenarios are not handled properly or do not provide helpful error messages. But there are things you can try.

If you encounter an error while compiling, see troubleshooting in Compilation.

Otherwise, head to #k on irc.notroll.net and start complaining.



  • Keywords - Detailed account of Ferret keywords

  • Operators - Detailed account of Ferret operators

  • Variables - Explanation of Ferret variable types

  • Functions - Explanation of Ferret functions and events

  • Scopes - Explanation of Ferret contexts and lexical scoping

Standard library

  • Basic datatypes

  • Math

    • Complex - Complex numbers

    • Math - Math functions and constants

      • Point - 2D points

      • Line - Line segments

      • Rect - Rectangles

      • Vector - Vectors of any dimension

      • Matrix - Matrices of any dimensions

  • Date and time

    • Time - Represents a moment in time

      • Duration - Represents a duration of time

  • Networking

    • HTTP - HTTP suite

      • Client - Represents an HTTP user agent

      • Request - Represents an HTTP request

    • IRC - IRC suite

  • Encoding

    • JSON - JSON serialization and deserialization

  • Development

    • Test - Basic test suite