Qore (programming language)
![]() | This article may be too technical for most readers to understand.(June 2016) |
Qore | |
---|---|
Paradigm | multi-paradigm: thread safe/parallel/shared memory, functional, imperative, object-oriented (class-based), procedural, functional |
Designed by | David Nichols |
Developer | David Nichols |
Stable release | 0.8.12
/ June 4, 2016 |
Typing discipline | Dynamic, Optionally Strong |
Implementation language | C++, Pthreads |
OS | Cross-platform |
License | MIT License, GNU General Public License, GNU Lesser General Public License |
Filename extensions | .q , .qm , .qtest |
Website | www |
Influenced by | |
Perl, D, C++, Java |
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 (meaning more than one part of the same code can run at the same time), and additionally because it features automatic memory management (meaning programmers do not have to allocate and free memory explicitly) while also supporting the RAII idiom with destructors for scope-based resource management and exception-safe programming.[1] This is due to Qore's unique prompt collection 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 scripts
Executable 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:
Thread safety and SMP scalability
- Perl: without
%new-style
, Qore's syntax is highly similar to Perl; theforeach
statement,splice
,push
,pop
,chomp
operators, Perl5-compatible regular expressions, and more - Java: with
%new-style
, Qore code looks more similar to Java[2]; thesynchronized
keyword, theinstanceof
operator, object and class implementation) - C++: multiple inheritance, exception handling, static methods, abstract methods
- D programming language: the
on_exit
,on_success
, andon_error
statements provide exception-aware functionality similar to D'sscope(exit)
,scope(failure)
, allowing exception-aware cleanup code to be placed next to the code requiring cleanup - Haskell (programming language): the
map
,foldl
,foldr
, andselect
operators
[3]
Data Types
Basic types include: boolean
, string
, integer
, float
, date
, binary
[4], list
, hash
(associative arrays), and object
[5], as well code code
for code used as a data type[6].
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.
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 design to support multithreading, Qore programs and scripts do not have to limit themselves to a subset of Qore's functionality, which is also where there is no Global interpreter lock in Qore[7].
Threading functionality in Qore is provided by the operating system's POSIX threads library.
Garbage Collection
Qore features a unique garbage collection approach called prompt collection 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 the Program
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[8].
Runtime Library
Qore's standard runtime library supports data mapping, APIs for communicating with databases (including high-level APIs for SQL operations, schema management, and DBA actions), client APIs and server infrastructure implementations for many protocols including HTTP, REST, WebSocket, RPC protocols, and many file format and file- and data-exchange protocols[9].
Availability
Qore's Git (software) repository is hosted on GitHub. Binary packages are available as RPM s, in MacPorts and in FreeBSD Ports as well as for other operating systems; see [General Source and Download Info] on the Qore wiki for more information.
References
- ^ "Why use Qore?". Qore.org. 2016-06-13. Retrieved 2016-06-14.
- ^ https://docs.qore.org/current/lang/html/parse_directives.html#new-style
- ^ https://github.com/qorelanguage/qore/blob/develop/ABOUT
- ^ "Basic Data Types". Qore.org. Retrieved 2012-05-31.
- ^ https://docs.qore.org/current/lang/html/container_data_types.html
- ^ https://docs.qore.org/current/lang/html/code_data_types.html
- ^ https://docs.qore.org/current/lang/html/threading.html
- ^ "Program Class". Qore.org. Retrieved 2016-06-13.
- ^ https://github.com/qorelanguage/qore/wiki/Modules
External links
- Qore Programming Language Home Page ("www.qore.org")
- Qore Wiki (github.com)
- Qore for the Perl Programmer (houston.pm.org)
- openSUSE ("software.opensuse.org")
- NetBSD ("ftp.netbsd.org")
- FreeBSD ("portsmon.freebsd.org")
- Dynamic programming languages
- Dynamically typed programming languages
- Free compilers and interpreters
- Free software programmed in C++
- Procedural programming languages
- Object-oriented programming languages
- Scripting languages
- Text-oriented programming languages
- Unix programming tools
- Cross-platform software
- American inventions
- High-level programming languages