<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I don't understand opaque types.<br><br><br>I do understand the notion of fully opaque types. That are fully revealed in one step.<br>In C this is common:<br><br><br> window.h <br> struct Window_t; <br> typedef struct Window_t Window_t; <br> Window_t* Window_Create(); <br> void Window_Show(Window_*t); <br> void Window_Close(Window_*t); <br> long Window_GetHeight(Window_*t); <br> long Window_GetWidth(Window_*t); <br> etc.<br><br> window.c <br> struct Window_t { ... } /* reveal */ <br><br><br>Back to Modula-3... opaque types must be OBJECTs, right?<br><br><br>1. What do they provide vs. more derived types?<br><br><br>INTERFACE Animal;<br><br>TYPE T = OBJECT<br>METHODS<br> makeNoise();<br>END;<br><br><br>INTERFACE AnimalImpl;<br><br>TYPE T = Animal.T OBJECT<br>METHODS<br> private();<br>END;<br><br><br>If I had an Animal.T and wanted to call private(),<br>wouldn't I just NARROW it to AnimalImpl.T?<br><br><br>Is the point that it is more efficient and avoids<br>a runtime type check?<br><br><br><br>INTERFACE Animal;<br><br>TYPE Public = OBJECT<br>METHODS<br> makeNoise();<br>END;<br><br>TYPE T <: Public;<br><br>INTERFACE AnimalImpl;<br><br>REVEAL Animal.T = Animal.Public OBJECT<br>METHODS<br> private();<br>END;<br><br><br>?<br>This way I can import AnimalImpl and then just call private()<br>without a NARROW?<br><br><br><br><br><br>2. Given that the final revelation must be a linear<br>form of all the declared subtypes, I don't understand<br>how the offset used by any module w/o a full revelation<br>could be anything other than zero.<br><br><br>I'd like to fully understand this, so I can make the C backend<br>provide maximal type information. More pointers to structs, with members/fields,<br>fewer untyped void*/char*.<br><br><br>Thanks,<br> - Jay<br><br><br> </div></body>
</html>