class Err1(msg: Str): Exception(msg)
class Err2(msg: Str): Exception(msg)
class MyType[A: MyGeneric, C](def super_field: Str)
class MyClass2[C, A: MyGeneric]: MyType[A, C]("the quick brown fox jumped over the slow donkey")
def fin z_modified: Str := "asdf"
def other_field: Int := 10
def init(self, other_field: Int, z: Int) raise [Err1] =>
if z > 10 then raise Err1("Something is wrong!")
self.z_modified := "fdsa"
def (a, b) := (10, 20)
def (a, b) := (30, 40)
(a, b) := (0, 10)
def my_bool := True
def a := self.error_function() handle
err1: Err1 =>
print(err1)
-1
err2: Err2 =>
print(err2)
-2
def error_function(self) -> Int raise [Err1, Err2] => 200
def connect(self) => self.other_field := 200
def _fun_b(self) => print("this function is private!")
def factorial(self, x: Int := 0) -> Int => x * self.factorial(x - 1)
def factorial_infinite(self, x: Int) -> Int => x * self.factorial(x)
def a(self) -> Int=> self.b(10)
def b(self, c: Int) -> Int => self.a()
def c(self, d: Int) -> Int => self.b(self.c(20))
def some_higher_order(self, fun: Int -> Int) -> Int? => fun(10)
def fancy(self) -> Int? => self.some_higher_order(\x: Int => x * 2)