Singular Manual: Identifier resolution

| ## 6.5 Identifier resolution In SINGULAR, an identifier (i.e., a "word") is resolved in the following way and order: It is checked for a reserved name (like `ring`, `std`, ...), a local variable (w.r.t. a procedure), a local ring variable (w.r.t. the current basering locally set in a procedure), a global ring variable (w.r.t. the current basering) a global variable, a monomial consisting of local ring variables written without operators, a monomial consisting of global ring variables written without operators. Consequently, it is allowed to have general variables with the same name as ring variables. However, the above identifier resolution order must be kept in mind. Otherwise, surprising results may come up.
    ring r=0,(x,y),dp;
    int x;
    x*y; // resolved product int*poly, i.e., 0*y
    ==> 0
    xy; // "xy" is one identifier and resolved to monomial xy
    ==> xy
For these reasons, we strongly recommend not to use variables which have the same name(s) as ring variables. Moroever, we strongly recommend not to use ring variables whose name is fully contained in (i.e., is a substring of) another name of a ring variable. Otherwise, effects like the following might occur:
    ring r=0,(x, x1),dp; // name x is substring of name x1 !!!!!!!!!
    x;x1;   // resolved polynomial x
    ==> x
    ==> x1
    short=0; 2x1; // resolved to monomial 2*x^1 !!!!!!
    ==> 2*x
    2*x1; // resolved to product 2 times x1
    ==> 2*x1

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