Skip to content

v0.5.1

Latest
Compare
Choose a tag to compare
@isaiahshiner isaiahshiner released this 06 Jul 15:24
· 14 commits to master since this release
fd0db98

Functions are finished!

This release is nearly a total rewrite. In the April 2020 prototype, "functions" were extremely limited. The language was not designed to be fully generic, or recursive, and there was no way to adapt it without a major rewrite. That rewrite is now complete! This means you can now do things like this:

getConfig();
pull JavaScript, Python, Lua from 'https://raw.githubusercontent.com/ditabase/dits/master/langs/commonLangs.dit';

sig JavaScript func jsLoop(Num counter){|
    for(let i=0; i<2; i++) {
        <|counter = (|<|counter|> + 1|)|>;
        <|print(counter)|>;
    }
    <|pyLoop(counter)|>;
    if(<|counter|> === 8) {
        <|print('Functions in any language!')|>
    }
|}

sig Python func pyLoop(Num counter){|
    for i in range(2):
        <|counter = (|<|counter|> + 1|)|>
        <|print(counter)|>
    
    <|luaLoop(counter)|>
|}

sig Lua func luaLoop(Num counter){|
    for i = 0, 2 do
        <|counter = (|<|counter|> + 1|)|>
        <|print(counter)|>
    end
|}

jsLoop(1);

This is absolutely as powerful as it seems. You can use any library from any other language at any time. I've shown JavaScript (NodeJS), Python, and Lua here, but you can currently add any interpreted language very easily! Compiled languages will also work with a minor change. You can see a complete tutorial on the new functions here, and how these languages were implemented here.

0.5.1 was released to fix typos in links.