Version 2.0.0
Release Version 2.0.0
Here we are! After more than 7 months, 2.0.0 is finally here. With the general release of the new type solver, Class++ 2.0 feels finally ready to be released.
I would like to thank everyone who used Class++, reported bugs, and sent feedback. Without them, I wouldn't be able to make Class++ as good as it is now. Feel free to make more bug reports if you encounter them!
Below is a general change-log of everything from the new type solver beta releases to this release. There are lots of things that you need to know about.
Changes from 1.2.1
- Class++ has been re-written from the ground up.
- The source code of Class++ has been re-written from scratch for the new type solver. This is to support the new advanced type features that allows Class++ to be more intelligent than ever before.
- Now using the new
@selfalias with require-by-string in the modules. - The main API surface is generally the same, however, the inheritance syntax and certain methods have been changed.
- An
objectwill now have auto-completion for certain default methods. - Updated Inheritance
- Deprecated the
class.extendsmethod and instead merged the functionality with theclassfunction of the main API. - Added multi-inheritance.
- Changed the Protected Access Specifier behavior to allow for a better overwriting system. (Similar to C++)
- Automatic parent class constructor calling has been removed.
- Constructors and destructors are no longer inherited.
- Added
super().- super is a new default method of an
object, which allows you to access parent class methods from child classes. - super, when called in a class method, calls the method with the same name in the parent class of the class it's been called from.
- super can be used both in normal class methods and constructors, allowing you to create chain systems like in other OO languages.
- super is a new default method of an
- Deprecated the
- Major Type Overhaul
- The old Type API has been replaced with a better and a more consistent one.
- The old
Type.typeof()andType.typeofClass()methods have been replaced withType.type()andType.typeof()methods that are more compatible and consistent with Luau's built-intype()andtypeof()functions. You can even replace these built-in methods with Class++'s Type API, and your code will still work!
- The old
- Class and Object types are now far more advanced than they were ever before, the object type now supports auto-complete for all of the members (including private and protected) in the
classDatatable. class.newnow reflects the parameter types of the definedconstructorfunction in theclassDatatable. This also includes inherited classes.- In inherited class objects, private members will now properly show up in the auto-complete.
- When a class member is set to
falsein theclassDatatable, Class++ will now show it asany, instead ofboolean. This is to reduce type errors when first defining members in theclassDatatable. (You can go around this by casting or annotating it tobooleanlater.) - The type system is now more consistent and faster.
- The old Type API has been replaced with a better and a more consistent one.
- Automatic Object Destruction
- Class++ now mostly, if not entirely, removes the need to manually track your objects. It will now automatically track and detect when your objects are no longer referenced in runtime, and if so, will then destroy the object.
- When an object no longer has any references:
- If the object has already been destroyed with the
:Destroy()method, the internalobjectDatawill properly be disposed of. (Recommended) - If the object hasn't already been destroyed,
destructor(if it exists) will be called with a copy of theobjectData. This is to ensure backwards compatibility, and to make this system properly work. The copyobjectDatashould never be held onto, as afterdestructorruns it will immediately be disposed of. - This can be configured through the new
autoObjectDestructionproperty of the main API. destructorfunctions will now emit a non-fatal error from Class++ when an error occurs in the function.
- If the object has already been destroyed with the
- Replaced the Error API with Log API
- Class++ now has an advanced Log API, unlike the simple and old Error API, it allows for different kinds of output messages.
- To make debugging easier, Class++ error messages are now more consistent in style and easier to read, and they will now provide links (in Studio), allowing you to find more information about the error.
- Certain error messages now provide more information.
- General Improvements and Bug Fixes
- Class creation is now faster.
- Object creation is faster in certain cases. (e.g when
autoObjectDestructionis disabled) - Object indexing is now faster.
Destroy()can no longer be called within constructors.- Class++ will now properly clean threads and
RBXScriptConnectionsinside objects, alongsideInstances. - Fixed Friend access specifier not using the class references properly to allow other classes access to Private and Protected members.
- Fixed overloaded functions not being able to access Private and Protected members of their class.
- Fixed bugs related to being able to set a class member to nil.
- Fixed bugs allowing you to re-define members in different access specifiers.
- Fixed an internal bug with operator overloading.
- Fixed a bug where indexing the class object would allow you to bypass the
classDatarestrictions. - Fixed major bugs related to object and class creation.
- Updated the Documentation
- Documentation now has a brand new interface, with better colors and style.
- All of the sections have been completely re-written with better wording and examples.
- Documentation now has new sections and a better API reference.
- Documentation will still show 1.2 as an older version.