Dot functions
Remember how I said everything's a function? I've been working on dot notation, which of course are also functions. But they're procedurally generated functions at compile time to keep them safe, which is... particularly goofy.
Foo
{
Int a
Int GetA(Foo this)
{
Return this.a
}
}
Void Main()
{
Declare Foo foo
Foo.GetA(foo)
foo.GetA()
}
becomes
Foo
{
Int a
Int GetA(Foo this)
{
Return Get_a(this)
}
Int* Get_a(Foo this)
as "$0.a"
{
Return #access(this, a)
}
}
(Foo => Int) Get_GetA(Type<Foo> foo)
as "$0.GetA"
{
Return #access(foo, GetA)
}
(() => Int) Call_GetA(Foo foo)
as "$0.GetA"
{
Return () => #access(foo.Type, GetA)(foo)
}
Void Main()
{
Declare Foo foo
Get_GetA(Foo)(foo)
Call_GetA(foo)()
}
These extra generated functions only exist in the compiler though, and can't be accessed any other way.