[DGD] Clarifying private and static function classes

Shentino shentino at gmail.com
Fri Jul 3 23:00:17 CEST 2009


My understanding is that a private function is completely invisible outside
the object that defines it.  DGD can't call it, subclasses and superclasses
can't call it, and call_other can't call it from anywhere.

I would think in this case, call_other(C, "foo") is completely agnostic to
any private functions defined anywhere, let alone in A and B.  call_other(C,
"foo") would pick the first from this list:

1.  Any non-private functions defined in C
2.  Any non-private functions defined in C's ancestors, with the nearest
ancestor getting preferential treatment.  Static functions are ignored if
call_other is called from outside the object.

If the same function is defined in multiple inheritance paths, I would think
that would result in a compile error.  Such as if A and B both defined a
non-private foo that C didn't override.

On Fri, Jul 3, 2009 at 12:55 PM, Felix A. Croes <felix at dworkin.nl> wrote:

> Matt Tolton <matt at tolton.com> wrote:
>
> > On Fri, Jul 3, 2009 at 4:51 AM, Felix A. Croes<felix at dworkin.nl> wrote:
> > >> This seems to differ from other LPC dialects [1], where private does
> > >> not protect against call_other.
> > >
> > > Suppose that objects A and B both have a private function "foo". C
> > > inherits both A and B. What function does call_other(C, "foo") call?
> >
> > If I understand correctly, in DGD that would not call any function and
> > just return nil.  In other LPC dialects, I don't know.  Mind if I ask
> > what you're getting at here?
>
> What function <should> call_other(C, "foo") call?
>
> My point is that DGD's implementation of private functions is not
> exceptional or difficult to understand, since these variant dialects
> are clearly incorrect.
>
> Regards,
> Felix Croes
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>



More information about the DGD mailing list