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
233 stars 24 forks source link

Auto generating multi-method default handler with type casting for variadic argument list #522

Closed arakov closed 2 months ago

arakov commented 3 years ago

The following code should work:

B;

C
{
    B cast()
        = new B();
}

singleton E
{
    load(params B[] o)
    {
        for(int i := 0, i < o.Length, i += 1)
        {
            console.writeLine(o[i])
        }
    }
}

public program()
{
    var b := new B();
    var c := new C();

    var e := E.load(b,c);
}

The output should be

$private'B
$private'B
arakov commented 2 months ago

fixed in ELENA 6.0.10