<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 07.11.2019 um 01:33 schrieb Ben
Grasset via fpc-pascal:<br>
</div>
<blockquote type="cite"
cite="mid:CAL4d7FjaDAk6qx+9_gkMD4SV8vK157wAQzR15Xbyzf5xgjqVLw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">On Wed, Nov 6, 2019 at 12:44 PM Sven Barth via
fpc-pascal <<a
href="mailto:fpc-pascal@lists.freepascal.org"
moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="auto">
<div dir="auto">Pascal has a strong type safety, thus
something like the if-expression won't be used/allowed
to weaken that. </div>
<div dir="auto"><br>
</div>
<div dir="auto">If that means that some things can't be
implemented in generics the "easy" way, then so be it.</div>
</div>
</blockquote>
<div><br>
</div>
<div>I agree that Pascal has strong type safety.</div>
<div><br>
</div>
<div>IMO conditional branching based on compile-time constant
evaluation, that cannot fail, does not do anything
resembling weakening it, however. </div>
<div><br>
</div>
<div>It strengthens it, and has no downsides, because it's
verified by the compiler.</div>
<div><br>
</div>
<div>Encouraging typecasting (which cares only about the sizes
of the types involved, nothing else) at the programmer level
is far more error-prone in a variety of ways.</div>
</div>
</div>
</blockquote>
If there is no type checking, then it is *not* verified by the
compiler. If I have an if-expression with an always true if-clause I
could write any syntactically correct garbage in the else-clause if
type checking would be disabled, because the compiler would not
verify it. And this is not how Pascal works. And also not how FPC's
parser works. We're taking huge care that generics are correctly
type checked and that as many errors as possible are caught when
writing the generic (instead of when specializing), so we're not
going to introduce something like this. The if-expression is
intended to be like C/C++'s ternary operator nothing more, nothing
less cause that is what most people want to use it for.<br>
<br>
Regards,<br>
Sven<br>
</body>
</html>