One possible approach is to use an anon-sub, which would assure the privacy, another would be to ask Ovid to provide some kind of support for them :)
My support for them is probably going to be limited to documentation unless someone can convince me otherwise. If someone wants private methods, go the anonymous subroutine route. This approach has the benefit of being extremely lightweight and adds no code to Class::Trait.
I could add code to simply ensure that methods in traits which begin with an underscore are not flattened into the class, but what if someone wants to create a trait with helper methods a class uses but which should not be publicly available? Then I thought "private method could beging with a double underscore". The problem with that is some programmers use single underscores to denote a protected method and double underscores to denote private methods (and I know of one shop which perversely uses the reverse convention). That's when I realized that for me to enforce an abritrary method naming convention on folks was a bad idea. Anonymous subroutines is the way to go.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re^3: Informal Poll: (private methods in traits)
by Ovid
in thread Informal Poll: why aren't you using traits?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |