Closed grtodd closed 3 years ago
The issue was that roles can be followed by a list, like this:
class Widget with Size("large");
When this happens, Size
is interpreted not just as a role, but as a role-generator — a package that can generate new roles on the fly. It passes the parameter "large" to the role generator, gets given a role back and applies that role to the Widget
class. There's also class generators.
What I forgot was that parentheses are not the Perl operator for building lists; commas are. So parentheses are not required around lists. So your example was getting parsed like:
class Cow extends Animal( with Milkable );
That is, Animal
was a class-generator getting passed with Milkable
as its list.
I've changed the parsing for generators to require explicit parentheses now.
I'll try to get a new release out this evening.
(And yes, Moops + Kavorka is built on top of a pile of crack. Zydeco has more solid foundations, so will hopefully be more maintainable long term, even if it's way less tested right now.)
Released 0.606
Great explanation of the debug and fix, thanks. Or uhh (thanks).
Zydeco Nothing to report so far but I can't get the synopsis code from
Zydeco::Manual::01_ClassesRolesEtc
to run unless I change:class Cow extends Animal with Milkable;
to the following:
Could be due to fast moving dev, code churn or a missing dependency on my end. Anyway, great project! Glad to see something new picking up where the lure of the animal left off ;-)