Singular Manual: Assignments for user defined types

| ### 4.24.5 Assignments for user defined types By default, only objects of the same (user defined) type can be assigned, there is no automatic type conversion as for the kernel data types. But the operator `=` can be overridden in oder to write custom constructors (the custom constructor does not apply to assignments of the same type): via `system("install",` user_type `,"="` `,p,1);`. The user_type has to be given as a string. Example:
      newstruct("wrapping","poly p");
      proc wrap(poly p)
      {
        wrapping w; w.p = p;
        return  (w);
      }
      system("install", "wrapping", "=", wrap, 1);
      ring r = 0,x,dp;
      wrapping w = x+1;
      w;
    ==> p=x+1
      w = int(1); // via conversion int->poly
      w;
    ==> p=1
      w=number(2); // via conversion number->poly
      w;
    ==> p=2
The user defined procedure for `=` provides also generic type conversions: `hh A=hh(b);` is equivalent to `hh tmp=b; hh A=tmp; kill tmp;`.

User manual for Singular version 4.3.2, 2023, generated by texi2html.