oif2003 wrote: ↑11 Dec 2018, 17:35
Kind of hard to beat obj.str version, god I hate that dot!
I can't wait for
lexikos to extend fat arrow support to property "half-methods"
I guess (correct me if I'm wrong)
metafunctions just don't work for
prototype classes and objects created with
{} thats why we need to instantiate it first. its not an issue for small classes with 1 task (1 property) but still doesn't feel right b/c we don't exploit inheritance and other goodies of OOP in the case but just a mere property emulation for the sake of code size reduction.
fat arrows for
properties would be perfection!
At least we can do ++ with this version (unlike the fat arrow version).
yuppers! Actually the framework is quite functional for other tasks.
btw, with nested levelness increase, fat-arrow function method (aka
Testing Case 1) starts slowing down unproportionally compared to deref[] method (aka
Testing Case 2):
Code: Select all
class a{
static b:={"c":{"key":0}}
}
2301 | 2046 | 1922 : 3000000
+4.5% | +2.3% | +3.4%
2.
From another topic: here is a version I ended up with for self-initializing prototype class with __Get, __Call, etc meta-functions functioning w/o instantiation.
Code: Select all
ClassN:={base:ClassN}
class ClassN{
static __Call:=(_, _method, _args*) =>_args[1]
}
MsgBox(ClassN.a2("1st arg"))
I tested
Class1.base:=Class1 as well but it seems to work only for the first assignment