-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Scalp\PatternMatching\Deconstruction trait provides construct and deconstruct methods, holds internally data that represents construction arguments.
Problem related with current implementation:
Destruction::constructmust be called manually with right arguments. It's easy to forget or passed wrong arguments.- Constructor arguments are duplicated, one copy is managed by object and second is hold inside trait.
Improvement proposals:
Destruction::deconstructcould throw exception when trying to deconstruct object that was never constructed.- Trait should be replaced with abstract class,
__constructshould be used to bind type construction arguments. In this case__constructshould be protected agains extension in subclasses. Abstract method should be provided to let subclasses do finish object construction.
Reactions are currently unavailable