ELENA-LANG / elena-lang

ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
https://elena-lang.github.io/
MIT License
236 stars 26 forks source link

try-catch-finally opeator #539

Closed arakov closed 3 years ago

arakov commented 3 years ago

Redesign try-catch-finally opeator to simplify its syntax and free | operator for #538

arakov commented 3 years ago
A
{
    test2() { console.writeLine("test2") }
}

public program()
{
    var a:= new A();

    // try alternatives
    a.test() \ test2();        

    // try and catch
    a.test() \\ on:(Exception e) { console.writeLine("exception") };    

    // try, finally and catch
    a.test() $fnl { console.writeLine("finally") }  \\ on:(Exception e) { console.writeLine("exception") };
}    
arakov commented 3 years ago

done