<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 9/24/26 5:18 PM, Cary Coutant via
Dwarf-discuss wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAJimCsFxtJUKFO_2U57JoxJ92jOQxUp1_B4ddqhpd9=dDrrd9Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_quote gmail_quote_container">
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Currently
there are the values<br>
DW_ACCESS_public DW_ACCESS_private DW_ACCESS_protected<br>
<br>
FreePascal has more (list at the end of mail)<br>
Could those please be added?<br>
<br>
<a
href="https://www.freepascal.org/docs-html/ref/refse35.html"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.freepascal.org/docs-html/ref/refse35.html</a><br>
> Private<br>
> All fields and methods that are in a private block,
can only be <br>
> accessed in the module (i. e. unit) that contains the
class definition.<br>
> They can be accessed from inside the classes’
methods or from <br>
> outside them (e. g. from other classes’ methods)<br>
> Strict Private<br>
> All fields and methods that are in a strict private
block, can only <br>
> be accessed from methods of the class itself. Other
classes or <br>
> descendent classes (even in the same unit) cannot
access strict <br>
> private members.<br>
> Protected<br>
> Is the same as Private, except that the members of a
Protected <br>
> section are also accessible to descendent types, even
if they are <br>
> implemented in other modules.<br>
> Strict Protected<br>
> Is the same as Protected, except that the members of
a <br>
> Protected section are also accessible to other classes
implemented in <br>
> the same unit. Strict protected members are only
visible to <br>
> descendent classes, not to other classes in the same
unit.<br>
> Public<br>
> sections are always accessible.<br>
> Published<br>
> From a language perspective, this is the same as a
Public section, <br>
> but the compiler generates also type information that
is needed for <br>
> automatic streaming of these classes if the compiler
is in the {$M+} <br>
> state. Fields defined in a published section must be of
class type. <br>
> Array properties cannot be in a published section.<br>
</blockquote>
<div><br>
</div>
<div>From these descriptions, it looks to me like "strict
private" and "strict protected" better match the existing
meaning of DW_ACCESS_private and DW_ACCESS_protected,
respectively (i.e., access is restricted to members of the
class rather than the whole module, which is more like what
these attributes mean for C++ code). If I'm understanding
that correctly, would it be more accurate to add new
enumerators for Pascal's plain "private" and "protected"
attributes? Say, DW_ACCESS_module_private and
DW_ACCESS_module_protected?</div>
</div>
</div>
</blockquote>
I see what you mean Cary. At first I was confused. I believe that
the referenced page on FreePascal.org has added some text that
clarify the meaning since the time when I first put together the
DWARF issue. <br>
<p>In the context of freepascal "module" is roughly equivalent to
the DWARF and ELF notion of a compilation unit. I did a bit of
history research into the original module private and module
protected specifications. How the concept of "private" vs. "strict
private" and the similar protected accessibility declarations
evolved is interesting. A module was basically assumed to be
written by one author and thought to be a group of collaborating
classes, That is why they had module wide access. However as the
size of code increased and computers and compilers got faster the
amount of code increased and so the notion that a module was the
work of one author who understood all the relationships was
increasingly not true. Consequently, they introduced the concept
of "strict private" which is as you pointed out more akin to what
we see in C++ and Ada.</p>
<p>However, one thing that I am not really clear about in DWARF is
does DW_ACCESS_private have a specific semantic meaning
independent of the language. If it does, then it is not specified.
I can see it two different ways:<br>
<br>
DW_ACCESS_private has a semantic meaning in DWARF separate from
the language. In that case because the FreePascal concept of
"strict private" maps more closely to C++'s concept of "private"
which is translated in DWARF into DW_ACCESS_private, "strict
private" should map to DW_ACCESS_private.</p>
<p>If we do this then I think we need to more clearly define what
the implied semantics of the Accessibility codes mean and do it in
such a way that it is independent of any language. <br>
<br>
The other way that I can see it is DWARF acts as a mapping between
the source language and the machine language and is interpreted by
the consumer only in the context of the the language that the code
was written in. In that case, it is the language that provides the
semantic meaning of what the Accessibility Declaration means. That
would lead to DW_ACCESS_private mapping to the (module) private
keyword in the language. Strict private mapping to
"DW_OP_strict_private"...</p>
<p>This would require more of the consumers. For example: libabigail
would have to understand the difference between
"DW_ACCESS_private" as it applies to C++ and how it applies to
FreePascal.</p>
<p>I would say that I implicitly wrote
<a class="moz-txt-link-freetext" href="https://dwarfstd.org/issues/260428.1.html">https://dwarfstd.org/issues/260428.1.html</a> assuming the latter but
as I think about the complexity of retrofitting this kind of
language dependent semantics into a tool like libabigail, I kind
of prefer the former. </p>
<p>The problem that I worry about is that there may not be perfect
overlap between the semantics of different language's notion of
what different accessibility declarations mean. This could lead to
an explosion of DW_ACCESS_* qualifications to capture the nuances
of different language's semantic differences in the meaning
concepts like private protected or public. Even the two languages
that we reference in the non-normative text leading into this
section C++ and Ada have very different concepts of private and
protected and you can't really assume that DW_ACCESS_private for
Ada means the same thing as DW_ACCESS_private does to C++. </p>
<p>This is a tough question. So what do we want to do?</p>
<p>-ben</p>
<blockquote type="cite"
cite="mid:CAJimCsFxtJUKFO_2U57JoxJ92jOQxUp1_B4ddqhpd9=dDrrd9Q@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote gmail_quote_container">
<div>I don't see a need to represent "published" as distinct
from "public".</div>
<div><br>
</div>
<div>While we're at it, I see the need to add more descriptive
text in the spec to make these accessibility attributes more
broadly applicable across languages.</div>
<div><br>
</div>
<div>-cary</div>
<div><br>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
</body>
</html>