David Storrs wrote:


Incidentally, I just want to go on record as saying that the verbosity of class declarations in P6 is really starting to skeeve me. I keep reminding myself that these are the edge cases that are being discussed, that you don't need all this stuff for the common case (right?) that Perl 6 can be pretty much the same easy, succint, fun language that I know and love, that sensible defaults will be chosen so that in the common case the things I get automatically are the things I wanted anyway. But, occasionally, I still find myself going "eeew...Java."



I have been having the opposite feeling: I rather like the verboseness of class declarations, and their self documenting nature. It's not like java in that I have the freedom to be as specific or as vague as I want to be. I can say C<< has Cat %.foo is shape(Dog) >> if I want to, or C<has %.foo> otherwise. Except for cases like the hypothetical Geometry::Triangle I can live with this, and maybe even in that case, because again it is probably a Good Idea. I don't know what happens when we have classes for which we do not know all the attributes ahead of time, but for that something like AUTOMETH would work.


All this is subjective, of course, and I am fully with you that the possibility of being succinct should be open, to the extent that it is, er, possible. But there is a Pandora's box here:

1. When a class is composed, all the roles and the current class are meshed together; Clearly, if a role uses an attribute expecting it to be a particular type, it must explicitly say so (to avoid clashes with other roles or the class). Taciturnity, then, is open only to classes.
2. It will also be impossible to spot typos in argumentless method calls because that could be an undeclared attribute. (of the current class or any of its ancestors or roles)
3. If we use $.foo without declaring it, how would the compiler know if it is an object attribute or a class attribute?


I think that "slackness-on-demand" is a better policy than "strictness-on-demand", but that, again, is just my opinion....

--abhijit

Reply via email to