Search found 38 matches
- Sun Apr 23, 2017 8:17 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
well, it doesn't generate almost identical code, because you can't override individual methods without overriding whole __meta table, and also it generates fractals if you don't nil the table
- Sun Apr 23, 2017 7:51 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
it's the same as my code just spread out, and it still makes fractals when removing self.__meta = nil on line 2
- Sun Apr 23, 2017 7:45 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
i'm choosing ease of debugging versus whatever that fractal of headache is
- Sun Apr 23, 2017 7:39 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
so i have discovered that nilling the __meta table is not a good idea, in any cases, so now it's a matter of choosing that little bit of performance at the risk of being potentially harder to debug, or cleanliness
- Sun Apr 23, 2017 7:37 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
well, from the end user perspective it makes no difference functionally, perhaps i can make it use reference instead. it's just that i don't like recursing stuff as it opens the potential to be incredibly hard to debug. though metatables are hard to debug in general, and i've also noticed it doesn't...
- Sun Apr 23, 2017 7:29 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
rawget() doesn't work at all, in fact it breaks metamethods
- Sun Apr 23, 2017 7:17 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
that's because you aren't inheriting
- Sun Apr 23, 2017 7:10 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
well, it technically "works", but try using this dump method to check the resulting structure of an inheriting class function indent(depth) local s = '' for i=0,depth do s=s..' ' end return s end function dump(table, label, depth) local depth = depth or -1 local label = label or tostring(t...
- Sun Apr 23, 2017 7:05 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
here's visible difference in using copying(current method) vs referencing (suggested) respectively
the problem makes itself apparent when inheriting which is shown above- Sun Apr 23, 2017 6:51 pm
- Forum: Libraries and Tools
- Topic: clasp - tiny class library
- Replies: 29
- Views: 20982
Re: clasp - 13 lines of class
- Setting everything to weak keys seems suspicious/unnecessary, why do that? I saw some class library use weak keys, so I put them in too, dunno if it changes much really, removed it because keeps the code shorter - Calling pairs every time you instantiate a class is slow, can that be moved to decl...