BOSQUE language

An Overview of Bosque

The Bosque programming language is designed for writing code that is simple, obvious, and easy to reason about for both humans and machines. The key design features of the language provide ways to avoid accidental complexity in the development and coding process. The goal is improved developer productivity, increased software quality, and enabling a range of new compilers and developer tooling experiences.

To simplify collaboration with other researchers and the wider developer community this project is set up around an open-source (MIT) licensed GitHub repository. This project welcomes community contributions including, issues, comments, pull requests and research based on or enhancing the Bosque language.

Mark Marron Principal RSDE Said on Hacker Rank

The Bosque language is currently in a very early stage with lots of work to do and not ready for practical use. However, I am very excited by the potential in the concepts and wanted to make the project a collaborative endeavour, including both other academics and developer community, from the start. At this point the goal is to explore interesting options in the language design space – whether the Bosque language becomes mainstream or just provides useful ideas for other languages to adopt. So, please take a look, expect plenty of rough edges, and we would love comments, suggestions, and PR’s on the GitHub repo.

ALSO READ  Ruby-most important programming language

Small samples of code to give a sample flavor are below Example.

Add 2 numbers:

function add2(x: Int, y: Int): Int {
    return x + y;
}

add2(2, 3) //5

All odd check using rest parameters and lambda:

function allOdd(...args: List[Int]): Bool {
    return args->all(fn(x) => x % 2 == 1);
}

allOdd(1, 3, 4) //false

Bulk update properties on Record

function update(point: {x: Int, y: Int, z: Int}, value: Int): {x: Int, y: Int, z: Int} {
    return point<~(y=value, x=-point.x);
}

update(@{x=1, y=2, z=3}, 5) //@{x=-1, y=5, z=3}

Noneable access on optional argument:

function tryGetProperty(r?: {f: Int, k: Int}): Int? {
    return r?.f;
}

Sign (with optional argument):

function sign(x?: Int): Int {
    var! y: Int;

    if(x == none || x == 0) {
        y = 0;
    }
    else {
        y = (x > 0) ? 1 : -1;
    }

    return y;
}

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.