public static Surrogate internLogicObjectSurrogate(Symbol name) {
    if (!((Module)(Stella.$MODULE$.get())).clearableP()) {
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

          try {
            Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
            stream000.nativeStream.println("ERROR: Can't define the term `" + name + "' in the unclearable module `" + ((Module)(Stella.$MODULE$.get())).moduleFullName + "'.");
            Logic.helpSignalPropositionError(stream000, Logic.KWD_ERROR);

          } finally {
            Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
          }
        }
        throw ((PropositionError)(PropositionError.newPropositionError(stream000.theStringReader()).fillInStackTrace()));
      }
    }
    { Surrogate oldsurrogate = Logic.lookupLogicObjectSurrogate(name, ((Module)(Stella.$MODULE$.get())));
      Stella_Object oldvalue = ((oldsurrogate != null) ? oldsurrogate.surrogateValue : ((Stella_Object)(null)));
      Module oldmodule = ((oldvalue != null) ? oldvalue.homeModule() : ((Module)(null)));

      if ((oldvalue != null) &&
          (!(oldmodule == ((Module)(Stella.$MODULE$.get()))))) {
        if (((Boolean)(Stella.$WARNIFREDEFINEp$.get())).booleanValue()) {
          {
            System.out.println("Defining `" + name + "' would cause a term with the same name");
            System.out.println("   of type `" + Logic.nameObjectMetaclass(oldvalue) + "' in module `" + oldmodule.moduleFullName + "' to be shadowed.");
          }
;
          {
            System.out.println("CAUTION: Automatic shadowing can be dangerous, because forward ");
            System.out.println("   references to a shadowed object may be bound to the now shadowed ");
            System.out.println("   object.  Suggestion: Explicitly shadow the name using");
            System.out.println("   DEFMODULE's `:shadow' option.");
          }
;
          if (!(Stella.yesOrNoP("Do it anyway? "))) {
            { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

              { Object old$PrintreadablyP$001 = Stella.$PRINTREADABLYp$.get();

                try {
                  Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                  stream001.nativeStream.println("ERROR: Couldn't shadow name `" + name + "' in `" + ((Module)(Stella.$MODULE$.get())).moduleFullName + "'.");
                  Logic.helpSignalPropositionError(stream001, Logic.KWD_ERROR);

                } finally {
                  Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$001);
                }
              }
              throw ((PropositionError)(PropositionError.newPropositionError(stream001.theStringReader()).fillInStackTrace()));
            }
          }
        }
      }
      if (Logic.explicitlyQualifiedLogicObjectNameP(name, ((Module)(Stella.$MODULE$.get())))) {
        { Object old$Module$000 = Stella.$MODULE$.get();
          Object old$Context$000 = Stella.$CONTEXT$.get();

          try {
            Native.setSpecial(Stella.$MODULE$, ((Module)(name.homeContext)));
            Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
            return (Stella.shadowSurrogate(name.symbolName));

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Stella.$MODULE$.set(old$Module$000);
          }
        }
      }
      else {
        return (Stella.shadowSurrogate(name.symbolName));
      }
    }
  }