1.2 Summary of Language Mechanisms

qBeta contains the following language mechanisms:

  • As for Beta, qBeta has one abstraction mechanism, the pattern:
    • A pattern is a unification of common abstraction mechanisms such as class, value type, method, function, process type, et al.
    • The benefit of this unification is that qBeta supports the notion of virtual class – similar to virtual method as found in most OO languages
    • Another benefit is that a method may be subpatterned from a (super) method similar to a class can be subclass from a (super) class.
  • qBeta supports singular objects – an object may be described directly without being an instance of a class  – called anonymous classes in Java
  • qBeta supports nesting of patterns and singular objects – also know as block structure. Few OO languages supports block-structure in its full generality as in Beta and qBeta.
  • qBeta supports cooperative and preemptive coroutines as well as coroutines executing in full concurrency (in parallel) on multi-core processors
  • In qBeta it is possible to define schedulers for coroutines.
  • At the very basic level, qBeta has a set of primitive mechanisms for synchronization and interface to hardware cores – these includes
    • compareAnd Swap, enabling and disabling of preemption, association of active objects with processor cores
  • The abstraction mechanisms of qBeta makes it possible to define safe high-level concurrency abstractions like Monitor, Ada-like rendezvous, Actor-like systems, etc. 
  • qBeta includes a mechanism called subpattern restrictions, which makes it possible to define restrictions on subpatterns of a given pattern.
    • On of the benefits of subpattern restrictions makes it possible to define safe concurrency abstractions. In Beta, Java and C++, the compiler is not able to enforce safety with respect to avoid race conditions.
  • In qBeta, a module is a singular object.
  • Declarations and statements may be mixed and declarations are executed.
  • The syntax of patterns names may be unary, binary, functional or keyword inspired by Smalltalk and Self.
  • New control structures may be defined by means of patterns, typically using a keyword syntax.
  • The syntax for nesting of patterns and singular objects is based on indentation as in Python – i.e no curly brackets..

Hello world