# Accessibility Declarations for FreePascal ## Issue DWARF Version 5 only has Accessibility declarations `DW_ACCESS_public`, `DW_ACCESS_private`, and `DW_ACCESS_protected`. However, Free Pascal defines additional accessibility specifiers that need representation. This addition allows debuggers to report member accessibility accurately to users and enables ABI checkers like libabigail to detect API changes that affect the ABI of an object. The full list can be found in the [Free Pascal Reference Guide][ref]. [ref]: https://www.freepascal.org/docs-html/ref/refse35.html In the documentation for Free Pascal, the terminology that they currently use literally uses the word "visibility". This led to some confusion and this topic was extensively researched. The conclusion that we arrived at is that in the Pascal community it is customary to use the word "visibility" in a way where it is synonymous with the DWARF concept of accessibility. This use should not be confused with ELF symbol visibility or the DWARF concept of visibility. It is just historical and customary in Pascal community to use "visibility" and "accessibility" interchangeably. ### Strict vs module It was debated whether to add `DW_ACCESS_module_private` and `DW_ACCESS_module_protected` or `DW_ACCESS_strict_private` and `DW_ACCESS_strict_protected`. The hope was that `DW_ACCESS_private`and `DW_ACCESS_protected` could be used for FreePascal's "strict private" and "strict protected" since the semantics more closely match those of the existing access qualifiers which were based on C++'s semantics. Then the FreePascal "private" and "protected" keywords could be mapped to `DW_ACCESS_module_private` and `DW_ACCESS_module_protected`. The problem with this approach was that other implementations of Pascal already use `DW_ACCESS_private`and `DW_ACCESS_protected` in a way that means "module private" and "module protected". Changing this in DWARF6 would force a version check at the translation unit level. Therefore, to maintain backward compatibility, it was decided to simply add the strict versions of the access qualifiers. ### Published Free Pascal also has a concept of "published". This topic was also researched extensively. The graphical GUI editor for the extension to Pascal called Delphi that Free Pascal was derived from relied on Run Time Type Information (RTTI) to associate graphical widgets with classes that implemented their functionality. The Free Pascal compiler uses the "published" keyword to instruct the compiler to include this RTTI information with the class. ## Proposal In Section 2.7: Add Pascal to the list of languages which have Accessibility of Declarations so that it reads: > *Some languages, notably C++, Ada, and some dialects of > Pascal, have the concept of the accessibility of an object or of > some other program entity. The accessibility specifies which classes > of other program objects are permitted access to the object in > question.* Just before the table in Section 2.7 add this paragraph: > The precise meaning and semantics of these codes must be interpreted > in the context of the rules of source language where the declaration > is made. In Table 2.4 add two more accessibility codes and add second column with their meaning: > | Accessibility code name | Meaning | > | ----------------------------- | ------------------------------------ | > | `DW_ACCESS_public` | The declaration can be used anywhere without access restriction. | > | `DW_ACCESS_private` | The declaration can be accessed only by the members and friends of the class in which it is declared.\* | > | `DW_ACCESS_protected` | The declaration can be accessed only members and friends of the class in by which it is declared, by classes derived from that class, and by their friends.\* | > | `DW_ACCESS_strict_private` | The declaration can be accessed only by the members and friends of the class in which it is declared.\* | > | `DW_ACCESS_strict_protected` | The declaration can be accessed only members and friends of the class in by which it is declared, by classes derived from that class, and by their friends.\* | > | `DW_ACCESS_published` | The declaration can be used anywhere without access restriction and the compiler has included additional run time type information needed by GUI building tools. | Then after the table, add the following footnote: > *\*As an example of how these codes must be interpreted > in the context of the rules of the source language, in some dialects > of Pascal "private" and "protected" are understood to also allow > unrestricted access within the module or translation unit, while > "strict private" and "strict protected" have semantics closer to > C++'s use of private and protected.* In Section 8.9 Add the following entries to table 8.14: > | Accessibility code name | Value | > | ----------------------------- | ----- | > | `DW_ACCESS_strict_private` | TBD | > | `DW_ACCESS_strict_protected` | TBD | > | `DW_ACCESS_published` | TBD | --- 2026-05-10: Added `DW_ACCESS_published` for completeness. 2026-09-24: Added Pascal to non-normative text listing languages that have accessibility attributes. 2026-09-29: Removed `DW_ACCESS_strict_private/protected` and added `DW_ACCESS_module_private/protected`; Added basic semantics of different policies. 2026-10-23: [Revised][diff1]. Replaced "published" accessibility code with a new `DW_AT_rtti` attribute. Fixed incorrect description for `DW_ACCESS_module_protected`. 2026-11-04: [Revised][diff2]. Moved back to strict private and protected, and added published back as an access qualifier.