[e-lang] Defining DeepPassByCopy

Mark Miller erights at gmail.com
Wed Feb 28 19:08:46 CST 2007


On 2/27/07, Kevin Reid <kpreid at mac.com> wrote:
> ? e`a` :DeepPassByCopy
> # value: e`a`
>
> ? e`a`.__optUncall()[0] :DeepPassByCopy
> # problem: Not audited by DeepPassByCopy


The key confusing piece of code in the current E-on-Java
implementation responsible for this inconsistency is the following
snippet from Ref#isDeepPassByCopy/2:

                Object[] elements = ((Selfless)ref).getSpreadUncall();
                int len = elements.length;
                if (1 <= len) {
                    //We count on the standard convention to only put a maker
                    //in position 0 when it represents the object's behavior,
                    //not its state.
                    Object maker = elements[0];
                    if (!(maker instanceof StaticMaker) &&
                      !isDeepPassByCopy(maker, optSofar)) {

                        return false;
                    }
                }
                for (int i = 1; i < len; i++) {
                    if (!isDeepPassByCopy(elements[i], optSofar)) {
                        return false;
                    }
                }
                return true;

It exempts a StaticMaker in uncall position 0. I see no rationale that
would justify this exemption.

-- 
Text by me above is hereby placed in the public domain

    Cheers,
    --MarkM


More information about the e-lang mailing list