Typed superset of R
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 = 123 # increment in place4 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 missing2 func foo(x: int): int {3 return x + 14 }56 # flag that y does not exist7 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 NULL
values too often, not with Vapour.
1 let x: char = "hello, world"23 # will fail, wrong type4 x = NULL
- Vapour
- R
1 type person: object {2 age: int,3 name: char4 }56 func create(name: char): person {7 return person(name = name)8 }910 @generic11 func (p: any) set_age(age: int, ...: any): any1213 @default14 func(p: any) set_age(age: int): null {15 stop("not implemented")16 }1718 func(p: person) set_age(age: int): person {19 p$age = age20 return p21 }2223 let john: person = create("John") |>24 set_age(36)
1 create <- function(name: char) {2 return(structure(3 list(4 name = name5 ),6 class = c("person", "list")7 )8 })910 set_age <- function(p, ...) {11 UseMethod("set_age")12 }1314 set_age.default <- function(p, age) {15 stop("not implemented")16 }1718 set_age.person <- function(p, age) {19 attr(p, "age") <- age20 return(p)21 }2223 john <- 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