Skip to content

Complex type deconstruction #17

@pawaclawczyk

Description

@pawaclawczyk

Scalp\PatternMatching\Deconstruction trait provides construct and deconstruct methods, holds internally data that represents construction arguments.

Problem related with current implementation:

  1. Destruction::construct must be called manually with right arguments. It's easy to forget or passed wrong arguments.
  2. Constructor arguments are duplicated, one copy is managed by object and second is hold inside trait.

Improvement proposals:

  1. Destruction::deconstruct could throw exception when trying to deconstruct object that was never constructed.
  2. Trait should be replaced with abstract class, __construct should be used to bind type construction arguments. In this case __construct should be protected agains extension in subclasses. Abstract method should be provided to let subclasses do finish object construction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions