<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:Consolas;
mso-fareast-language:EN-US;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:Consolas;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 122.9pt 72.0pt 122.9pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText>> <span lang=EN-US style='mso-fareast-language:EN-AU'>-----Original Message-----</span></p><p class=MsoPlainText>> <span lang=EN-US style='mso-fareast-language:EN-AU'>From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of chris</span></p><p class=MsoPlainText>> <span lang=EN-US style='mso-fareast-language:EN-AU'>Sent: Tuesday, 16 June 2020 5:37 AM</span></p><p class=MsoPlainText>> <span lang=EN-US style='mso-fareast-language:EN-AU'>To: ETH Oberon and related systems</span></p><p class=MsoPlainText>> <span lang=EN-US style='mso-fareast-language:EN-AU'>Subject: Re: [Oberon] Type compatibility rules for Pointers</span></p><p class=MsoPlainText>> </p><p class=MsoPlainText>> On Mon, 15 Jun 2020 21:42:39 +0200, Michael Schierl wrote:</p><p class=MsoPlainText>> > Are you equally confused when you replace POINTER TO R by ARRAY 42 OF</p><p class=MsoPlainText>> > BYTE or even by INTEGER?</p><p class=MsoPlainText>> ></p><p class=MsoPlainText>> > i.e.</p><p class=MsoPlainText>> ></p><p class=MsoPlainText>> > TYPE I1 = INTEGER; I2 = INTEGER;</p><p class=MsoPlainText>> > A1 = ARRAY 42 OF BYTE;</p><p class=MsoPlainText>> > A2 = ARRAY 42 OF BYTE;</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> Yes I am. In my understanding this breaks the longstanding tradition since</p><p class=MsoPlainText>> the Modula days, that type compatibility is declared by name and not</p><p class=MsoPlainText>> inferred by structure (Only exception are procedure types for obvious</p><p class=MsoPlainText>> reasons and type extension).</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> > As I understand it, of all custom types only record types have identity.</p><p class=MsoPlainText>> > All other types are just aliases of what is on the other side of the</p><p class=MsoPlainText>> > equals sign. So it should not matter if you replace every occurrence</p><p class=MsoPlainText>> > of</p><p class=MsoPlainText>> > I1 by INTEGER or A1 by ARRAY 42 OF BYTE</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> The declaration</p><p class=MsoPlainText>> I1 = INTEGER;</p><p class=MsoPlainText>> declares an alias and no new type. ARRAY 42 OF BYTE is a new type.</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> The Oberon-2 report for example gives the first formal definition of "same</p><p class=MsoPlainText>> type" I know of and it clearly states in 1. that same types means same type</p><p class=MsoPlainText>> identifier.</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> "Same types"</p><p class=MsoPlainText>> Two variables a and b with types Ta and Tb are of the same type if</p><p class=MsoPlainText>> 1. Ta and Tb are both denoted by the same type identifier, or</p><p class=MsoPlainText>> 2. Ta is declared to equal Tb in a type declaration of the form Ta</p><p class=MsoPlainText>> =</p><p class=MsoPlainText>> Tb, or</p><p class=MsoPlainText>> 3. a and b appear in the same identifier list in a variable, record</p><p class=MsoPlainText>> field, or formal parameter declaration and are not open</p><p class=MsoPlainText>> arrays.</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> > I am not sure where I have this from (I can see that it is not</p><p class=MsoPlainText>> > actually defined in the Oberon 07 Report), perhaps this is just from</p><p class=MsoPlainText>> > experience from other programming languages.</p><p class=MsoPlainText>> </p><p class=MsoPlainText>> Looks you are right about Oberon-07. The Oberon-07 report is very vague</p><p class=MsoPlainText>> about this.</p><p class=MsoPlainText>> </p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='color:black'>There has been much debate about this in the past. Not all of the rules are explicitly spelt out in the Language Report. In the introduction to the Language Report Wirth says:<o:p></o:p></span></p><p class=MsoPlainText><span style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span style='color:black'>“… What remains unsaid is mostly left so intentionally, either because <b><i>it is derivable</i></b> from stated rules of the language…”<o:p></o:p></span></p><p class=MsoPlainText><span style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span style='color:black'>However, that does require the reader to exercise some mental gymnastics in cases like these. If you prefer a more explicit version, I recommend this one. I believe it to be correct but would be interested if anybody spots any flaws:<o:p></o:p></span></p><p class=MsoPlainText><span style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><a href="https://miasap.se/obnc/type-compatibility.html">https://miasap.se/obnc/type-compatibility.html</a><o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Regards,<o:p></o:p></p><p class=MsoPlainText>Chris Burrows<o:p></o:p></p><p class=MsoPlainText>CFB Software<o:p></o:p></p><p class=MsoPlainText>https://www.astrobe.com<o:p></o:p></p><p class=MsoPlainText><span style='color:black'><o:p> </o:p></span></p><p class=MsoPlainText><span style='color:black'><o:p> </o:p></span></p></div></body></html>