[DGD]returning copy() of arrays, objects

Frantisek Fuka fuxoft at terminal.cz
Mon Jan 31 03:28:03 CET 2000


While studying Melville Mudlib I found out that the functions which
return objects, arrays or mappings return "copy (result)" instead of
just "result", where copy() is defined in auto.c as:

nomask mixed copy (mixed a) {
    mixed b ;
    if (typeof(a)==T_ARRAY || typeof(a)==T_MAPPING) {
        b = a[..] ;
    } else {
        b = a ;
    }
    return b ;
}

There is probably some rationale behind it but I don't understand why
pointer values must be returned like this. And I probably don't need to
understand it. But I need to know: Do I really have to return all
objects, arrays and mapping like this? What could happen if I don't? (I
tried and it seemed to work fine)

-- 
                                         Frantisek Fuka 
(yes, that IS my real name)
(and it's pronounced "Fran-tjee-shek Foo-kah")
My E-mail:   fuxoft at terminal.cz
My Homepage: http://www.fuxoft.cz
My ICQ:      2745855

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list