Informix Error -4021
-4021 A class member cannot be named "SELF".
You cannot use SELF, regardless of letter case, as the name of a member variable, member constant, or member function. The identifier SELF is a built-in identifier that New Era provides automatically. You can refer to SELF to make your code more readable when a member has the same name as an identifier that is declared as in the global or module scope, or to access a member when a local entity has the same name.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4021 fires when a member variable, constant, or function is named SELF — per the official
guidance, SELF (regardless of letter case) is a built-in identifier NewEra provides
automatically, used to reference the current object when a member shares a name with a
global/module-scope identifier or a local entity.
- A member declared with the name
SELF, per the official guidance — the direct, only cause.
Solutions / Resolution
- Choose a different name for the member, since
SELFis reserved as NewEra's built-in current-object identifier, per the official guidance.
Examples
A member named SELF
CLASS Order
DEFINE self INTEGER
-- -4021: "self" collides with the built-in SELF identifier (case-insensitive)
END CLASS
Corrected
CLASS Order
DEFINE order_id INTEGER
END CLASS
Diagnostic Checks
- Check every member variable, constant, and function name (case-insensitively) against
SELF, and rename any that collide.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4021 in this set yet.
A class member was named SELF, which is reserved as NewEra's built-in current-object
identifier — choose a different name.