Den 1. aug. 2017 kl. 13.27 skrev Matthew Browne <mbro...@gmail.com>:In particular, I think my suggestion of an 'internal' access level could be a useful way to indicate data class methods that shouldn't be public but which should be available to roles.
Is there a tl;dr; version of the discussion?
2. private means you can access anything in the package
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at https://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
Visit this group at https://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
I've never understood which evils protection on the class level protects against. What's needed is protection on the instanced level. Class oriented thinking!
Den 3. aug. 2017 kl. 03.07 skrev Matthew Browne <mbro...@gmail.com>:So are you asserting that if a role needs access to a given instance method or property, then it always means that the instance method/property should be public to the entire app -- aside from the above exceptions?
Den 3. aug. 2017 kl. 13.58 skrev Risto Välimäki <risto.v...@gmail.com>:They do not prevent you to eg. take a memory pointer to a said "protected" or "private" property and modify it from there, but they communicate to you as a developer about what's appropriate do do with that property / method.
With the private.x syntax, how would you access a private field on a different object of the same class?
Why is this seen as a requirement?
I spent a lot of time questioning this too, but the case that convinced me was that this enables things like binary methods:
class User { #socialSecurityNum; constructor(ssn) { this.#socialSecurityNum = ssn; } isSamePerson(user) { return user.#socialSecurityNum === this.#socialSecurityNum; } }It also makes sense from a visibility perspective: If you have a private field, the only code that has visibility into it is the class's members. Thus, the logic that operates on the private field of one class instance is the same as the logic that operates on another class instance.
Moreover I couldn't find a compelling example of why this kind of visibility would be dangerous.
Den 4. aug. 2017 kl. 03.18 skrev Matthew Browne <mbro...@gmail.com>:First, just to be clear on the syntax: the proposal calls for using the # symbol to indicate private properties in Javascript (which is of course a controversial syntax, but that's another matter). In the above example, #socialSecurityNum is a private instance property.
This seems wrong to me, except maybe for the last point since I can't think of any practical cases where class-level visibility would cause a big problem.
Den 3. aug. 2017 kl. 12.43 skrev Matthew Browne <mbro...@gmail.com>:What if we also wanted CheckingAccount and InvestmentAccount sub-types, as in Cope's original version, and we wanted to give them access to the ledgers object without exposing it publicly?
Den 4. aug. 2017 kl. 03.34 skrev Matthew Browne <mbro...@gmail.com>:I think the example I mentioned is a suitable one - CheckingAccount and InvestmentAccount Contexts that both internally use an Account context (implemented with ledgers) as a role player / nested context.
--
Den 4. aug. 2017 kl. 19.09 skrev Matthew Browne <mbro...@gmail.com>:Hi Cope,
If I understand correctly, you're arguing that access modifiers for methods should apply to the method itself - so neither class-level nor instance-level encapsulation. What about properties?And it sounds like you're saying that access modifiers for languages with only single-dispatch -- most OO languages including trygve -- aren't even worth discussing here. Did I understand you correctly?
class D: public B {protected void p(const B* that) {this->p(this); // okthis->Base::p(this); // o.k.B* self = this;self->Base::p(this); // not okthat->Base::p(this); // not okthat->p(this); // not ok}
class D: protected B {protected void p(const B* that) {this->p(this); // ??this->Base::p(this); // ??B* This = this;This->Base::p(this); // ??that->Base::p(this); // ??that->p(this); // ??}
--
Den 4. aug. 2017 kl. 23.19 skrev Risto Välimäki <risto.v...@gmail.com>:I have forgot already most that I ever knew about C++,
I think it would help make this idea more concrete in my mind if I had some idea what the syntax might look like. I was just searching on Google and might have missed something, but it doesn't look like any existing language has direct support for multiple dispatch together with access modifiers that would work for the social security number example.
It seems to me you'd need a way to specify which properties the
method should be able to access. Not a real suggestion, but for
demonstration:
internal function
myMultimethod(ClassA a {foo}, ClassB b) {
...
}
where foo is an instance property of objects of class A that
myMultimethod should be allowed to access. This may be way
off-base.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
Visit this group at https://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
Visit this group at https://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
Den 5. aug. 2017 kl. 18.18 skrev Matthew Browne <mbro...@gmail.com>:Okay. I hope that someday there will be an effort to create a language that has support for both multiple dispatch and DCI.