Qore: A New Programming Language Worth a Look

New programming languages are created all the time. Over the past 10 years alone, we’ve seen the emergence of Rust, Dart, Kotlin, Elixir, Red, Julia, TypeScript and Swift—and those are just the better-known ones (lesser-known ones include P4, PureScript, Hopscotch, Hack, Zig, Ballerina and Bosque). 

Here’s a new name to add to that list of new languages: Qore. Although Qore hasn’t yet hit version 1.0 (it’s at 0.9.4), it’s clear that a lot of work has been done, giving it the feel of a very practical programming language.

What kind of Programming language is Qore?

Qore was originally designed “to facilitate embedding integration logic in a workflow/technical order management system” (i.e., it was designed as a domain specific language). However, it’s now an interpreted, high-level, general-purpose, dynamic programming language with garbage collection. 

Qore’s syntax has been described as a mix of Perl, Java, C++ and D with a touch of Haskell. Considering the extensive detailing of the reference pages, it’s surprising that there are so few examples of source code. The only examples I’ve found were in the examples folder in the Qore GitHub download file and they were narrowly focused on email, webserver, pop3, etc. But perhaps that’s the side effect of a language less than a year old. 

The following example, which gives some flavor of the language, is taken from the file inner.q in the aforementioned examples folder. It uses old-style variables with $ (You’ll find mentions of both new-style and old-style in the documentation). The old style is more Perl-like with $ variables, as seen below. The newer style does away with $, and is more Java/C+-like and definitely more compact. 

Both new-style and old-style are compiler directives, so you are free to switch between them. A utility script, old2new, is provided in the examples:

class Base2 {
    # declare some private members
    private $.base2, $.y;

    constructor($a) {
        printf("Base2::constructor(%n)\n", $a);
        $.b = $a;
    copy() {
        printf("Base2::copy() (%n)\n", $.b);
        $.b = $.b + "-copy"; 
    destructor() {
        printf("Base2::destructor() (%n)\n", $.b);
    hello() {
        printf("Base2 hello (%n)\n", $.b);

    # note that "Base2" here is just a regular method, the constructor
    # is always named "constructor"
    Base2($a) {
        printf("Base2::Base2() (%n) %n\n", $.b, $a);

The Language

Qore is a scripting language and has a Linux feel to it. The first line in most scripts specifies the location of the Qore interpreter, similar to Python. Also, like Python, # are comments: 


Qore is weakly typed, so variables can hold any type unless you have specified a type. This is known as optionally strong. 

In the example below, the words ‘our’ and ‘my’ are used to distinguish between global and local variables. The int ‘a’ that is assigned a value ‘2’ is also local, whereas the first ‘a’ is global: 

our int a = 1;                  # this is a global variable
our (string b, any c, hash d);  # list of global variables
if (a == 1) {
    int a = 2;
    my (string b, any c);
    printf("local a = %d\n", a);
printf("global a = %d\n", a);

If you know C or C++, you’ll find the syntax quite similar. As well as standard types such as Boolean, String, Integer etc., there’s also Number, an arbitrary precision floating point type. But it gets more interesting with things such as multiple assignments in one statement:

(a, b, c, date) = (1, "two", 3.3, 2005-10-28)


One way to extend the language is by using modules. With Qore, around 60 are provided, including high-level features such as an HTTP server, APIs for networking, working with MySQL, PostgreSQL and SQLite, unit testing and so on. There are also another 20 modules provided separately (and of course, you can write your own). Modules are provided either in source form (user) or compiled C++ (binary). 

In an unusual twist for a scripting language, Qore supports Posix threads. There’s an extensive array of classes to manage threading objects such as locks, counters, gates, mutexes and queues. 

Garbage Collection

Qore supports garbage collection, using reference counting. When an object goes out of scope and the reference count reaches 0, the destructor is called. However, it can also detect cycles (as in cyclic directed graphs), which is quite clever (normally, this would make garbage collection difficult). 

Conclusion: Qore Worth a Look

Being a scripting language, Qore could replace C++/Java and Python utilities, especially as there’s no need to compile it.  In fact, you currently can’t compile, but a Qore compiler is under development.

The detailed online reference manual is light on examples, despite giving the language an intensive walk-through. It is a very practical language with many operators, including some from C++ but also list processing. 

The authors admit that it is in a state of transition from the old weakly-typed Perl like language to a stronger-typed language with the new_style syntax. If you are considering Qore, it’s worth taking a look at the Qore Wiki, particularly the ProTips page

If this were on Windows, I’d see it as a rival to PowerShell. In any case, this is definitely a language to watch. 

One Response to “Qore: A New Programming Language Worth a Look”

  1. David Nichols

    Thanks for the article on Qore – new style is really the only one used now – old Perl-style syntax is really only kept around for backwards compatibility with really old code (7 – 10+ years old).

    The garbage collector that you mention is unique I believe – Qore supports completely deterministic GC, which is why it can support C++-style destructors at the same time as completely automatic memory management. Qore also supports bidirectional Python compatibility (import Python code/modules into Qore and call APIs, use Python classes as base classes for Qore and vice versa) as well as Java compatibility (you can also dynamically import Java APIs into Qore and call them or use Java classes as base classes in Qore etc – calling Qore functionality from Java is also possible but due to the fact that we have no Java byte code generation to generate the Java shim for Qore code, you have to write the wrapper classes in Java manually which is a pain but doable). Also due to this you can import Java APIs dynamically into Python with Qore.

    Thanks again for the nice article about Qore!