Re: data() problems
[email protected] (Joshua N Pritikin)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Apr 20, 2000 at 02:22:25PM +0100, [email protected] wrote: > On Thu, Apr 20, 2000 at 08:02:02AM -0400, Joshua Pritikin wrote: > > On Thu, Apr 20, 2000 at 11:39:07AM +0200, [email protected] wrote: > > Sure, except that it is not easy to determine the correct package from > > inside Event::Watcher::init(). > > > > I don't know how to fix this, but I can add a warning to complain about > > 'data' in the constructor... > > I think you are getting confused between private data and public data. > > The code that Nick set was for private data in classes that inherit from > a base class. This is to ensure that sub-classes do not destroy > data used by the parent class. > > Passing data in the contructor is public data, it is set by the user > and not by a sub-class. > > In otherwords there should be two methods. One for the user, say data(), > and one for sub-classes that want to ensure data integrity, say private_data() Heh, I was pondering this all day. Shall I add a note in Event.pod mentioning that data() is meant only for implementors of event watchers? -- "May the best description of competition prevail." via, but not speaking for Deutsche Bank