Closed thekid closed 9 years ago
...from a user perspective.
At the same time, allow "is" and "with" (next to "including" for BC) to circumvent awkward feeling formulations. See https://github.com/xp-forge/partial/issues/10#issuecomment-143543442
use lang\partial\Identity; use lang\partial\Comparators; class Name extends \lang\Object { use Name\is\Identity; use Name\with\Comparators; }
use lang\partial\ListOf; class Customers extends \lang\Object { use Customers\is\ListOf; }
The inner workings to achieve consistent handling are the special case handling of traits:
if ($transform->kind()->isTrait()) { class_alias(strtr($transform->name(), '.', '\\'), $class); } else { $body= $transform->constructor()->newInstance()->transform($mirror); $code= // Generation omitted for brevitiy eval($code); }
Note: Use Identity inside the class will continue to work as before!
Use Identity
:heart: - this PR solves the handling issue IMHO, doesn't break BC, is extensible and doesn't come with a horrible overhead. Think I'll go for it.
...from a user perspective.
At the same time, allow "is" and "with" (next to "including" for BC) to circumvent awkward feeling formulations. See https://github.com/xp-forge/partial/issues/10#issuecomment-143543442
Example 1
Example 2
Implementation
The inner workings to achieve consistent handling are the special case handling of traits:
Note:
Use Identity
inside the class will continue to work as before!