<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 30.10.2013 12:06, schrieb Frederic
Da Vitoria:<br>
</div>
<blockquote
cite="mid:CANe_y9S3h15=JOQfeFzPAWXd=CeE8d5V2VBHA-kMWaJW6fCebQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">2013/10/30 Jonas Maebe <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
On 30 Oct 2013, at 10:36, Michael Van Canneyt wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I think it is an error. You declare something as
private, and then you use it in a public function ? If
that is not a visibility clash, I don't know what is :)<br>
</blockquote>
<br>
The ability to use types in public functions that are not
necessarily visible to users of that function is quite
common in Pascal. Otherwise, for consistency you would
also have to give a compile time error when compiling
this:<br>
<br>
unit u1;<br>
<br>
interface<br>
<br>
type<br>
tdynarray = array of integer;<br>
<br>
implementation<br>
<br>
end.<br>
*********<br>
<br>
unit u2;<br>
<br>
interface<br>
<br>
uses<br>
u1;<br>
<br>
function f: tdynarray;<br>
<br>
implementation<br>
<br>
function f: tdynarray;<br>
begin<br>
end;<br>
<br>
end.<br>
**********<br>
<br>
program test;<br>
<br>
uses<br>
u2;<br>
<br>
var<br>
a: array of integer;<br>
begin<br>
a:=f;<br>
end.<br>
***<br>
<br>
The tdynarray type is not visible in the program because
u1 is not in its uses clause (it's not in scope
whatsoever), and nevertheless there is no problem to use
it. It's of course not exactly the same (tdynarray isn't
declared as private to u1), but at the scope visibility
level it is the same situation as far as I am concerned.<br>
</blockquote>
</div>
<br>
</div>
<div class="gmail_extra">Precisely, shouldn't this trigger an
error too? The code should not be able to reference anything
for which the declaration isn't visible, isn't it?<br
clear="all">
</div>
</div>
</blockquote>
But the compiler can not know whether the user of unit u2 has unit
u1 in scope or not. <br>
<br>
Regards,<br>
Sven<br>
</body>
</html>