MyNixOS website logo
Description

Types and Features for Object Oriented Programming.

Construct message-passing style objects with types and features. Q7 types uses composition instead of inheritance in creating derived types, allowing defining any code segment as feature and associating any feature to any object. Compared to R6, Q7 is simpler and more flexible, and is more friendly in syntax.

Q7

Lifecycle:experimental Travis buildstatus

Q7 is a type system that enables a postmodern flavor of compositional object-oriented programming (OOP). It is simple, flexible and promotes healthy program design.

Q7 features:

  • type(), feature() and implement() to compose objects;
  • For each object, initialize() and finalize() to run at its beginning and end of life;
  • For each object, public, private, final, private_final and active binding modifiers to change the visibility and behavior of its members.

Installation

# install.packages("devtools")
devtools::install_github("iqis/Q7")
require(Q7)
#> Loading required package: Q7
#> Loading required package: magrittr
#> 
#> Attaching package: 'Q7'
#> The following object is masked from 'package:base':
#> 
#>     merge

Example

Make a Q7 object in 3 easy steps.

1, Define an object type:

Adder <- type(function(num1, num2){
    add_nums <- function(){
        num1 + num2
    }
 })

2, Instantiate the object:

myAdder <- Adder(1, 2)

3, Enjoy!

myAdder$add_nums()
#> [1] 3

See vignettes for extending an object and other topics.

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows