forked from iqis/Q7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
63 lines (50 loc) · 1.56 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# Q7
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Travis build status](https://travis-ci.org/iqis/q7.svg?branch=master)](https://travis-ci.org/iqis/q7)
[![CRAN status](https://www.r-pkg.org/badges/version/Q7)](https://CRAN.R-project.org/package=Q7)
<!-- badges: end -->
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
``` r
# install.packages("devtools")
devtools::install_github("iqis/Q7")
```
```{r}
require(Q7)
```
### Example
Make a Q7 object in 3 easy steps.
1, Define an object type:
```{r}
Adder <- type(function(num1, num2){
add_nums <- function(){
num1 + num2
}
})
```
2, Instantiate the object:
```{r}
myAdder <- Adder(1, 2)
```
3, Enjoy!
```{r}
myAdder$add_nums()
```
See vignettes for extending an object and other topics.