First, the new method normally takes parameters that match all my attributes. Well, why is it the caller's (the user of the object) business what my object's internal state is? What is the internal state in abstract, and even if that is pretty much implied by what it does, my specific choices of how to represent it?
Instead, my constructor arguments would be options used to configure the instance. Sure, some of these may be stored directly in attributes to be fetched later. But in general that's not the case. They will be used by the setup code to construct and arrange the various internal machinery of this instance, and may not be needed again ever.
Now I see there are ways to massage the arguments and such, but the framers of the system decided this was the normal thing to do, and the whole idea makes no sense to me. So am I fighting against it because I'm thinking about it wrong? What am I missing?
Second, what is the point of a read-only attribute? If it can't be set, it will never exist. There must be some "but..." in there.
More generally, there is no distinction (in the docs) between internal access by the instance, and access by others using the object. So how do I make attributes that are for internal use? Just giving it a name starting with an underscore is a collision waiting to happen, since the accessors are virtual methods, and my slots should be local to this specific class even if a derived class declares a slot with a name that happens to be the same. Is there a separate slot-access syntax that's not in the tutorials and manual? And why isn't that super prominent instead?!
My native language is C++, and I have looked at the Perl 6 object system and it all makes good sense to me. So what am I missing?
—John
In reply to Psychic Disconnect and Object Systems by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |