public static MethodSlot attachFunction(MethodSlot newfunction) {
    { Symbol name = newfunction.slotName;
      MethodSlot oldfunction = Symbol.lookupFunction(name);

      if (!MethodSlot.undefineConflictingDefinitionsP(newfunction)) {
        return (null);
      }
      Stella.$FUNCTION_LOOKUP_TABLE$.insertAt(name, newfunction);
      Slot.unregisterSlotName(newfunction);
      newfunction.slotExternalP = true;
      newfunction.finalizeSlotTypeComputations();
      if (oldfunction != null) {
        HookList.runHooks(Stella.$REDEFINE_RELATION_HOOKS$, List.list(Cons.cons(oldfunction, Cons.cons(newfunction, Stella.NIL))));
        oldfunction.free();
      }
      return (newfunction);
    }
  }