Qore Language

Qore
Paradigm(s) multi-paradigm: thread safe/parallel/shared memory, functional, imperative, object-oriented (class-based), procedural
Designed by David Nichols
Developer David Nichols
Stable release 0.8.3 (October 17, 2011; 4 months ago (2011-10-17))
Typing discipline Dynamic, Optionally Strong
Influenced by Perl, D, C++, Java
Implementation language C++, Pthreads
OS Cross-platform
License GNU Lesser General Public License
Usual filename extensions .q
Website www.qore.org

Qore is a high-level, general-purpose, interpreted, dynamic programming language. It's thread-capable, embeddable, weakly-typed language with optional strong typing and procedural and object-oriented features designed for anything from quick scripting to complex multithreaded, network-aware application development to embedded application scripting. Qore was initially designed to facilitate the rapid implementation of sophisticated interfaces in embedded code in an enterprise environment, and has since grown into a general-purpose language as well.[1]

Contents

Syntax

Qore syntax is similar to other programming languages (highly similar to Perl),[2] allowing new programmers to rapidly come up to speed in Qore. Qore borrows features from languages such as: C++ (ex: multiple inheritance, exception handling, static methods), Java (ex: the synchronized keyword, the instanceof operator, object and class implementation), Perl (ex: the foreach statement, splice, push, pop, chomp, splice operators, perl5-compatible regular expressions, and more), the D Programming Language (the on_exit, on_success, and on_error statements provide exception-aware functionality similar to scope(exit), scope(failure), allowing exception-aware cleanup code to be placed next to the code requiring cleanup), and others, also with many features unique to Qore. Furthermore, Qore supports closures (including binding local variables in the closure in a way that is safe to use even in multithreaded contexts) and features for advanced list processing (map, foldl, foldr, and select).[3]

Qore's operators are designed to produce the expected results for the programmer even when data types are mixed, a feature meant to further flatten the learning curve for new programmers.

Optional Strong typing

Basic types include: boolean, string, integer, float, date, binary, NULL, NOTHING.[4]

Data Containers

Qore supports three types of container types: lists, hashes (associative arrays), and objects. These container types can be combined to make arbitrarily complex data structures.[5]

The data type of any element can be any basic type or another aggregate type. The types do not have to be uniform in one container structure.

Thread Safety and SMP Scalability

All elements of Qore are thread-safe, and the language in general has been designed with SMP scalability in mind. The internal design and implementation of Qore favors multithreaded performance over single-threaded performance, so multithreaded Qore programs can count on an efficient and stable execution platform, and do not have to limit themselves to a subset of Qore's functionality (see Threading). Additionally, Qore includes optimizations designed to reduce the number of SMP cache invalidations that provide a substantial performance boost on SMP machines.

Qore supports deadlock detection in complex locking scenarios and will throw an exception rather than allow an operation to be performed that would cause a deadlock. Furthermore, Qore's threading primitives detect threading errors and throw exceptions in these cases as well.

A thread is an independent sequence of execution of Qore code within a Qore program or script. Each thread has a thread ID or TID. The first thread of execution in a Qore program has TID 1. TID 0 is always reserved for the special signal handler thread.

The Qore language is designed to be thread-safe and Qore programs should not crash the Qore executable due to threading errors. Threading errors should only cause exceptions to be thrown or application errors to occur.[6]

Threading functionality in Qore is provided by the operating system's POSIX threads library.

Embeddable

Qore was designed to support embedding 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 the Program class, discrete objects can be created and destroyed at will containing embedded code to extend or modify the behavior of your application in user-defined ways. The Program class allows the capabilities of embedded code to be arbitrarily restricted as well.[7]

Database Integration and DBI Layer

Retrieving, comparing, and manipulating data in a consistent manner from heterogenous database types is made possible by Qore's built-in database integration. Qore was designed with a database independent interfacing (DBI) layer, providing a standard interface for Qore programs to access any database supported by a Qore DBI driver (see the Datasource Class).[8]

Functions and Class Library

Qore's basic functionality covers areas such as: POSIX-compliant command-line parsing (ex: GetOpt Class), strong encryption and digest calculation, thread synchronization (ex: Queue Class, Mutex Class, Condition Class, etc), working with files (File class), socket, HTTP, and higher-level protocol communication (Socket, HTTPClient, FtpClient classes, optionally with TLS/SSL encryption), support for dynamic embedded application logic (Program Class). Additionally, Qore's functionality is extended with modules delivered separately from the Qore library (see Qore's home page for more information).

Availability

Qore's subversion repository is hosted on SourceForge. Versions are available as RPM s, in MacPorts and in FreeBSD Ports.

References

External links