Skip to main content

Typed superset of R

Early alpha

Vapour is extremely young, the syntax might change, things will break, expect bugs.

But please help the language mature 🙂

Vapour aims at making R developers more confident in their programs.

Why Vapour?

Syntax

A language that transpiles to R means we can leverage the existing R body of work but improve things in some places by having the syntax change faster than the underlying language, akin to the various ECMAScript for JavaScript.

1 let x: int = 1
2
3 # increment in place
4 x += 41

Robustness

Disassociating the code written by the developer from the code that ultimately is being run allows checking the written code for errors so they can be fixed before they are encountered.

Vapour can check for flagrant problems in the code at the time your write it, letting you fix them before they reach your users or even your unit tests.

1 # warn that x might be missing
2 func foo(x: int): int {
3 return x + 1
4 }
5
6 # flag that y does not exist
7 print(y)

Types

With the rise of dynamically typed programming languages, developers have found out that, it turns out, types were not just to help the compiler, they actually help the developer just as much.

In R, we get caught out by NA, or NULLvalues too often, not with Vapour.

1 let x: char = "hello, world"
2
3 # will fail, wrong type
4 x = NULL
1 type person: object {
2 age: int,
3 name: char
4 }
5
6 func create(name: char): person {
7 return person(name = name)
8 }
9
10 @generic
11 func (p: any) set_age(age: int, ...: any): any
12
13 @default
14 func(p: any) set_age(age: int): null {
15 stop("not implemented")
16 }
17
18 func(p: person) set_age(age: int): person {
19 p$age = age
20 return p
21 }
22
23 let john: person = create("John") |>
24 set_age(36)


Contribute

Language

Help improve the language!
Contribute

Editor integration

Help integrate the syntax highlighting and LSP of Vapour in various editor.

Feedback

Share your feedback in the form of Github.
Give feedback

Roadmap

1) R type inference

Infer types from base R so type checking can be executed.

2) Autocompletion LSP

The LSP currently only provides diagnostics, it should also provide autocompletion (and maybe more).

3) Vapour type inference

Infer types in Vapour to reduce verbosity a tad.

4) Vapour package development tools

Vapour could probably provide functionalities similar to those provided by devtools.

5) Improve transpiler

The transpiler currently outputs valid but extremely ugly R code.

6) Formatter

Include a formatter.

7) Extensions

Allow extending Vapour, e.g.: with @decorators