<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
This is what you "have to" chose between.<BR>
Header cloning or C code (and C headers).<BR>
<BR>
CONST or VAR (or functions?)<BR>
<BR>
I'm going to likely make the Uerror change tonight.<BR>
You can still veto it (er, vote against it :) )<BR>
<BR>
Possibly some convuluted C (enum/#undef), or splitting the Modula-3<BR>
at boundaries that weren't previously believed "natural".<BR>
(See how SetupHandlers is ~two lines in Modula-3 and the rest in C;<BR>
this is partly out of ignorance. I don't know how to write those<BR>
two lines in C; and laziness, I didn't look into how).<BR>
<BR>
<BR>
<BR>
Remember I'm still staying away from mainstream platforms,<BR>
so the value isn't what it might appear to be, but it is "stage setting",<BR>
and the show might go on. :)<BR>
<BR>
<BR>
Also, the dilemna does get more difficult now, with the little C header cloning that remains.<BR>
<BR>
For example, look at Upthreads.i3.<BR>
Mainly, look at function prototypes.<BR>
Constants and types are "known problems".<BR>
Prototypes are gray. They actually tend to be portable.<BR>
<BR>
For example:<BR>
<BR>
TYPE pid_t = INTEGER;<BR>
<*EXTERNAL "m3_getpid*> PROCEDURE getpid():pid_t;<BR>
<BR>
or leave it alone?<BR>
getpid is probably the worst example.<BR>
It is so very portable declared in Modula-3.<BR>
But still, imagine pid_t might be 16bits or 32 or 64.<BR>
Writing a wrapper is more portable -- as long as the pid isn't stuff into some record that the system defines.<BR>
<BR>
<BR>
Again, Upthreads.i3.<BR>
Would you like to see it reduced, or left alone?<BR>
Only deal with the types and initializers, or also the prototypes?<BR>
You know, I could write a little portable layer, where all the types are pointers, always null initialized.<BR>
It would buy /some/ portability, and cost some.<BR>
<BR>
<BR>
Do you like the sem_t change? Partly? Not at all?<BR>
There is one sem_t in the system. So I moved it to be in C code.<BR>
Or, as I had it before, declared as the max size/align of all the platforms -- getting that right is the same work as getting it right "the old way", except if you make a mistake, odds are still good of it being ok.<BR>
<BR>
<BR>
Should the line be drawn at generating the remaining headers, rather than eliminating them?<BR>
Uerror.i3 is easily generated. Good enough?<BR>
<BR>
Upthread.i3's types can be generated generally as records with opaque arrays with the right size and alignment.<BR>
<BR>
Other stuff can be generated or at least checked.<BR>
e.g. to check that getpid is declared correctly, you can assign it to a function pointer and see if that compiles.<BR>
<BR>
Perf on Uerror arguably doesn't matter.<BR>
Is it only error handling code?<BR>Or do sockets often go down "error" paths, because they are slow and you are waiting for more data?<BR>
<BR>
Anyway, point is, I agree for sure this is valuable, but I might be hitting the "tail" of the approach and should switch, I'm not sure. I keep saying that though, and then press further.<BR>
<BR>
<BR>
- Jay<BR><BR>
<HR id=stopSpelling>
<BR>
From: hosking@cs.purdue.edu<BR>To: jay.krell@cornell.edu<BR>Date: Mon, 12 Jan 2009 19:24:50 +1100<BR>CC: m3devel@elegosoft.com<BR>Subject: Re: [M3devel] declaring a type's existance but not enough to instantiate it?<BR><BR><BR>
<DIV><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV>Point taken. We live in a C universe and so need to interact. I do think your work with the headers is useful, and I want it to continue. Especially in simplifying ports.</DIV>
<DIV><BR></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></DIV>
<DIV>
<DIV>On 12 Jan 2009, at 19:18, Jay wrote:</DIV><BR class=EC_Apple-interchange-newline>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">I don't think a development system without C headers is interesting.. Is it really?<BR> <BR>The transform I apply at times is wherever there is interaction with C code that is described by system-dependent headers, or perhaps even fairly system-independent headers outside the Modula-3 tree, either write wrapper functions for the functionality in the headers (e.g. stat, waitpid), which can be done in a system-independent way, or move the Modula-3<->C transition higher, which is also usually system-independent, e.g. ThreadPThreadC_SetupHandlers.<BR> <BR>It is either that or clone the headers, which seems like the worse evil.<BR> <BR>There is always going to be a Modula-3<->C transition, it is just a matter of where it occurs.<BR> <BR> - Jay<BR><BR>
<HR id=EC_stopSpelling>
<BR>CC:<SPAN class=EC_Apple-converted-space> </SPAN><A href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</A><BR>From:<SPAN class=EC_Apple-converted-space> </SPAN><A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A><BR>To:<SPAN class=EC_Apple-converted-space> </SPAN><A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A><BR>Subject: Re: [M3devel] declaring a type's existance but not enough to instantiate it?<BR>Date: Mon, 12 Jan 2009 12:32:15 +1100<BR><BR><BR>
<DIV><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV>Jay, I really think you are bending over backwards too far just to be able to shoe-horn things into C. I *like* having the transpar of C header files expressed in Modula-3, *particularly* for system calls, where you might even be trying to build on a system that does not have the C header files installed, even though the libraries exist and can be linked to. Fundamentally, I think anytime the Modula-3 code is made less transparent you should think hard about what you are doing. The same with the change of constants to variables.</DIV>
<DIV><BR></DIV>
<DIV>I am getting very nervous that the changes you are making are destroying the clarity of the Modula-3 run-time code.</DIV>
<DIV><BR></DIV>
<DIV>In this particular case, you are wanting to use a Modula-3 parameter passing mechanism on something that is not declared in Modula-3. Seems kind of dubious to me. Also, I really don't like the idea of accessing external variables in C.</DIV>
<DIV><BR></DIV>
<DIV>-- Tony</DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></DIV><BR>
<DIV>
<DIV>On 12 Jan 2009, at 11:55, Jay wrote:</DIV><BR class=EC_EC_Apple-interchange-newline>
<BLOCKQUOTE><SPAN class=EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">I considered ADDRESS.<BR>However I think it still doesn't satisfy.<BR> <BR>I want to be able to do this:<BR> <BR>TYPE Foo_t = something;<BR><* EXTERNAL *> VAR Foo1, Foo2:Foo_t;<BR><* EXTERNAL *> PROCEDURE UseFoo(READONLY (* or VAR *) foo:Foo_t);<BR> <BR>(* Modula-3, not external *)<BR>PROCEDURE x()=<BR>BEGIN<BR> UseFoo(Foo1);<BR> UseFoo(Foo2);<BR>END x;<BR> <BR>AND I want any use of:<BR>VAR Foo3:Foo3_t; (* Modula-3, not external *)<BR><BR>to error. This is sem_t and sigset_t in particular.<BR> <BR>Possibly renaming is the thing.<BR>They used to be declared in Modula-3, system-dependently, but<BR>I moved them to portable C.<BR> <BR>I could remove the types entirely and change UseFoo to take an address,<BR>and declare mask and ackSem to be integers or I guess.<BR><*EXTERNAL> VAR ackSem : RECORD END;<BR> <BR>That would satisfy but I thought it might be nicer to still provide the named<BR>types to refer to the external variables.<BR> <BR> - Jay<BR><BR>
<HR id=EC_EC_stopSpelling>
<BR>From:<SPAN class=EC_EC_Apple-converted-space> </SPAN><A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A><BR>To:<SPAN class=EC_EC_Apple-converted-space> </SPAN><A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A><BR>Date: Mon, 12 Jan 2009 11:13:00 +1100<BR>CC:<SPAN class=EC_EC_Apple-converted-space> </SPAN><A href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</A><BR>Subject: Re: [M3devel] declaring a type's existance but not enough to instantiate it?<BR><BR>What's wrong with using ADDRESS for references to opaque values? If sigset_t is never instantiated in Modula-3, then why do you need it declared there?<BR>
<DIV><BR>
<DIV><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV><FONT class=EC_EC_EC_Apple-style-span color=#0000ff><FONT class=EC_EC_EC_Apple-style-span face="Gill Sans"><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Antony Hosking</SPAN></SPAN></FONT></FONT><FONT class=EC_EC_EC_Apple-style-span face="Gill Sans"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_Apple-converted-space> </SPAN>|<SPAN class=EC_EC_Apple-converted-space> </SPAN></SPAN></SPAN><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'">Associate Professor</SPAN></SPAN><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: 'Gill Sans'"> | Computer Science | Purdue University</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=EC_EC_EC_Apple-style-span face=GillSans-Light><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: GillSans-Light">305 N. University Street | West Lafayette | IN 47907 | USA</SPAN></FONT></DIV>
<DIV><FONT class=EC_EC_EC_Apple-style-span face="Gill Sans" color=#0000ff><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Office</SPAN></SPAN></FONT><FONT class=EC_EC_EC_Apple-style-span face=GillSans-Light><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: GillSans-Light"> +1 765 494 6001 |<SPAN class=EC_EC_Apple-converted-space> </SPAN></SPAN></SPAN></FONT><FONT class=EC_EC_EC_Apple-style-span face="Gill Sans" color=#0000ff><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'"><SPAN class=EC_EC_EC_Apple-style-span style="COLOR: rgb(0,0,255); FONT-FAMILY: 'Gill Sans'">Mobile</SPAN></SPAN></FONT><FONT class=EC_EC_EC_Apple-style-span face=GillSans-Light><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=EC_EC_EC_Apple-style-span style="FONT-FAMILY: GillSans-Light"><SPAN class=EC_EC_Apple-converted-space> </SPAN>+1 765 427 5484</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=EC_EC_EC_Apple-style-span face=GillSans-Light><BR class=EC_EC_EC_khtml-block-placeholder></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class=EC_EC_EC_Apple-interchange-newline></SPAN></DIV></SPAN></DIV><BR>
<DIV>
<DIV>On 12 Jan 2009, at 01:44, Jay wrote:</DIV><BR class=EC_EC_EC_Apple-interchange-newline>
<BLOCKQUOTE><SPAN class=EC_EC_EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_EC_EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Is there a way in Modula-3 to declare that a type exists, and there are <*external*> instances of it, without "fully" declaring it, so that no Modula-3 can instantiate it?<BR> <BR>I have done this for sigset_t and sem_t, but they could erroneously be instantiated by Modula-3 and I'd like to remove that ability to mess up so easily.<BR> <BR>(* This type is not declared correctly. It is only instantiated in C code. *)<BR> sigset_t = RECORD END;<BR><BR>(* This type is not declared correctly. It is only instantiated in C code. *)<BR> sem_t = RECORD END;<BR><BR>In C I believe you can do this, like:<BR> typedef struct foo foo_t; <SPAN class=EC_EC_EC_Apple-converted-space> </SPAN><BR> extern foo_t foo; <SPAN class=EC_EC_EC_Apple-converted-space> </SPAN><BR> <BR> void UseFoo(foo_t*);<SPAN class=EC_EC_EC_Apple-converted-space> </SPAN><BR> foo_t* GetFoo(void);<SPAN class=EC_EC_EC_Apple-converted-space> </SPAN><BR> <BR>Thanks,<BR> - Jay<BR><BR><BR><BR></DIV></SPAN></BLOCKQUOTE></DIV><BR></DIV></DIV></SPAN><BR class=EC_EC_Apple-interchange-newline></BLOCKQUOTE></DIV><BR></DIV></SPAN><BR class=EC_Apple-interchange-newline></BLOCKQUOTE></DIV><BR></body>
</html>