Qore (programming language)
Qore is an interpreted, high-level, general-purpose, garbage collected dynamic programming language, featuring support for code embedding and sandboxing with optional strong typing and a focus on fundamental support for multithreading and SMP scalability.
Qore is unique because it is an interpreted scripting language with fundamental support for multithreading, and additionally because it features automatic memory management while also supporting the RAII idiom with destructors for scope-based resource management and exception-safe programming. This is due to Qore's unique implementation for garbage collection.
Qore Scripts
Qore scripts typically have the following extensions:.q: for Qore scripts.qm: for Qore user modules.qtest: for Qore test scriptsExecutable Qore scripts on Unix-like operating systems will typically start with a hashbang to specify the filename of the interpreter as follows:
# !/usr/bin/env qore
Syntax
Qore syntax is similar to and inspired from the following programming languages:- Perl: without
%new-style, Qore's syntax is highly similar to Perl; theforeachstatement,splice,push,pop,chompoperators, Perl5-compatible regular expressions, and more - Java: with
%new-style, Qore code looks more similar to Java; thesynchronizedkeyword, theinstanceofoperator, object and class implementation - C++: multiple inheritance, exception handling, static methods, abstract methods
- D: the
on_exit,on_success, andon_errorstatements provide exception-aware functionality similar to D'sscope,scope, allowing exception-aware cleanup code to be placed next to the code requiring cleanup - Haskell: the
map,foldl,foldr, andselectoperators with lazy evaluation of functional and list operators and statements
Data Types
Basic types include:boolean, string, integer, float, date, binary, list, hash, and object, as well as code code for code used as a data type.Complex types are also supported such as
hash<string, bool>, list<string>, reference<list<string>> as well as .Multithreading
Despite being an interpreted language, Qore was designed to support multithreading as a fundamental design principle. All elements of Qore are thread-safe, and the language in general has been designed with SMP scalability in mind. Because all elements of the language were designed to support multithreading, Qore programs and scripts do not have to limit themselves to a subset of Qore's functionality, which is also why there is no Global interpreter lock in Qore.Threading functionality in Qore is provided by the operating system's POSIX threads library.
Garbage Collection
Qore features a unique garbage collection approach called that allows destructors to be run immediately when objects go out of scope, even if they have recursive references back to themselves. This allows for Qore to support the RAII idiom and also perform garbage collected automatic memory management.Support for Code Embedding and Sandboxing
Qore was designed to support embedding and sandboxing logic in applications; this also applies to applications written in Qore as well as applications using the Qore library's public C++ API. By using theProgram class which represents a logic container with sandboxing controls, discrete objects can be created and destroyed at runtime containing embedded code to extend or modify the behavior of your application in user-defined ways.