Skip to content

[Needs Verification] §5.14/§19.3.2 — TypeOf(T) (and IsConstValue) may be fabricated intrinsics #48

Description

@NickHodges

Sections: §5.14 Inline Expressions and Compiler Intrinsics table, §19.3.2 Type Information Functions table

Current text:
TypeOf(T) listed as a compiler intrinsic returning a class reference for a class type (§5.14), and again in the §19.3.2 Type Information Functions table (also listing IsConstValue(X), lower confidence).

Problem:
TypeOf does not appear to be a real Object Pascal compiler intrinsic (unlike TypeInfo, IsManagedType, HasWeakRef, GetTypeKind, which are real). This may be confused with C#/C's typeof, or with the TObject.ClassType instance method (not a global intrinsic taking a type identifier). It carries no "(Delphi 13+)" tag unlike other genuinely new intrinsics in this document, which is suspicious given the pattern in nearby entries. IsConstValue(X) is a second, lower-confidence candidate for the same treatment — flagged independently, two different sections both list a TypeOf-shaped entry.

Why this needs compiler verification:
Check actual Delphi 13.1 documentation/System.pas for both TypeOf and IsConstValue. Try compiling T := TypeOf(TMyClass); and see if it's accepted.

Suggested fix (pending verification):
Remove both rows if unconfirmed, or replace TypeOf(T) with the real construct (Obj.ClassType) if that was the intent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationneeds-compiler-verificationClaim needs verification against the real Delphi compiler before fixing

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions