[M3devel] religion, philosophy, Posix vs. Win32

Mika Nystrom mika at async.caltech.edu
Mon Jan 14 01:40:17 CET 2008


Jay,

I don't know if this is completely responsive to your question, and
take it with a grain of salt because I have never programmed on a
"pure" Windows system (and God willing, I never shall).

I expect the NT386GNU target, Cygwin, Windows-POSIX, whatever you
call it, to look as much as Unix "as possible."  (Obviously not,
but as "reasonable".)  The main things are (1) yes, /bin/sh, and
(2) Unix (POSIX?) libc---Modula-3 does a good job of covering up
the basic stuff so you don't need to worry about it for the most
part, but sometimes, just sometimes, you need to get, say, some
system information that doesn't have an existing M3 interface (say
the amount of free diskspace or something like that).  Then you
should be able to call C code that is portable between Unix and
Windows.

One thing that is bizarre about the old NT386GNU PM3 that doesn't
conform to the above description: it uses Windows Time.T.  It's all
the more bizarre because Cygwin uses Unix time_t.  (Time.Now and
time(3) are off by a couple of hundred years on NT386GNU, whereas
they are the same on all Unixes.)  I am sure there are other things.
Oh yes, the open-file (default) locking semantics are different
too.  Those two are actually the only differences that I noticed
in the programming environments.

     Mika

Jay writes:
>--_d0659847-2f20-454a-9665-5df3b5ce2832_
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>The conclusion here is:
> Just try to convince me otherwise. :)
>
>The gist of the question is:
>  Just what characteristics of "Posix" and "Win32" should "NT386GNU" have?
>
> Just what characteristics of "Posix" do people notice and like?
>You can't say "the whole thing". :)
>
>Restated:
>
>What is Posix? I don't mean, where is the standard document web site.
>I mean what is it TO YOU?
>
>Is it open/read/write/close?
>Is it fork?
>Is it sbrk?
>  On these previous ones, they are interesting to many programmers,
> but Modula-3 already layers over all this, so these are unlikely defining
>characteristics here.
>
>Is it sh? Probably somewhat. But if have you sat in Cygwin sh much vs. cmd?
> It is annoying. Command line history is flaky. Paths are munged to say /cy=
>gdrive.
> You lose the critical F8 command line completion against history feature.
>  You lose a lot of editing capability, but do gain some alternate possibly=
> "portable"
>  similar.
>
>Is it Perl? No.
>Is it X Windows. I doubt it.
>Is it pthreads? Probably not.
>  Or at least vtalarm? Maybe?
>  Or setjmp/longjmp? Ok.
>    Longjmp to the same buffer multiple times? Not likely.
>    Longjmp to a place that has already returned? Not likely.
>All full paths starting with a forward slash? Maybe.
>  Backward slash being a valid non-seperator path character? Maybe.
>
>Think about that last one.
>It is valid and occurs in Win32 code to treat forward slash and backward sl=
>ash the same.
>Some code does, some code does not.
>What if you just did that unconditionally, like even in Posix?
>What is the role of backward slash in Posix paths? It either just doesn't o=
>ccur,
>or is an escape character, or is a regular character. Something at a low le=
>vel
>could replace the backward slashes with forward slashes.
>
>I would like to change the code in m3-sys/cm3/m3path.m3 to treat backward s=
>lashes
>and forward slashes the same. Backward slashes just won't occur on Posix, r=
>ight?
>So far I have managed without this change, but not having it has bitten me =
>a few times.
>I do have the analogous change to the Win32 path code in m3core.
>
>It is the redundant filenames libfoo.a instead of foo.lib and libfoo.so ins=
>tead of foo.so?
>Perhaps. This seems dumb, redundant to me. Why have prefixes and suffixes?
>Don't suffixes suffice?
>
>That all said, I remain convinced that a useful intermediate or probably en=
>dpoint
>is a toolset that targets Windows using cm3cg, ld, as, but otherwise looks =
>like
>NT386 as much as possible. MAYBE alter the library names to libfoo.*.
>
>sh and make are needed for building cm3cg.
>I did use Cygwin for that. MinGWin sounds promising here too but I haven't =
>tried.
>
> - Jay
>
>
>_________________________________________________________________
>Get the power of Windows + Web with the new Windows Live.
>http://www.windowslive.com?ocid=3DTXT_TAGHM_Wave2_powerofwindows_012008=
>
>--_d0659847-2f20-454a-9665-5df3b5ce2832_
>Content-Type: text/html; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><html>
><head>
><style>
>.hmmessage P
>{
>margin:0px;
>padding:0px
>}
>body.hmmessage
>{
>FONT-SIZE: 10pt;
>FONT-FAMILY:Tahoma
>}
></style>
></head>
><body class=3D'hmmessage'>The conclusion here is:<br> Just try to conv=
>ince me otherwise. :)<br><br>The gist of the question is:<br>  Just wh=
>at characteristics of "Posix" and "Win32" should "NT386GNU" have?<br><br>&n=
>bsp;Just what characteristics of "Posix" do people notice and like?<br>You =
>can't say "the whole thing". :)<br><br>Restated:<br><br>What is Posix? I do=
>n't mean, where is the standard document web site.<br>I mean what is it TO =
>YOU?<br><br>Is it open/read/write/close?<br>Is it fork?<br>Is it sbrk?<br>&=
>nbsp; On these previous ones, they are interesting to many programmers,<br>=
> but Modula-3 already layers over all this, so these are unlikely defi=
>ning<br>characteristics here.<br><br>Is it sh? Probably somewhat. But if ha=
>ve you sat in Cygwin sh much vs. cmd?<br> It is annoying. Command line=
> history is flaky. Paths are munged to say /cygdrive.<br> You lose the=
> critical F8 command line completion against history feature.<br>  You=
> lose a lot of editing capability, but do gain some alternate possibly "por=
>table"<br>  similar.<br><br>Is it Perl? No.<br>Is it X Windows. I doub=
>t it.<br>Is it pthreads? Probably not.<br>  Or at least vtalarm? Maybe=
>?<br>  Or setjmp/longjmp? Ok.<br>    Longjmp to the sam=
>e buffer multiple times? Not likely.<br>    Longjmp to a pla=
>ce that has already returned? Not likely.<br>All full paths starting with a=
> forward slash? Maybe.<br>  Backward slash being a valid non-seperator=
> path character? Maybe.<br><br>Think about that last one.<br>It is valid an=
>d occurs in Win32 code to treat forward slash and backward slash the same.<=
>br>Some code does, some code does not.<br>What if you just did that uncondi=
>tionally, like even in Posix?<br>What is the role of backward slash in Posi=
>x paths? It either just doesn't occur,<br>or is an escape character, or is =
>a regular character. Something at a low level<br>could replace the backward=
> slashes with forward slashes.<br><br>I would like to change the code in m3=
>-sys/cm3/m3path.m3 to treat backward slashes<br>and forward slashes the sam=
>e. Backward slashes just won't occur on Posix, right?<br>So far I have mana=
>ged without this change, but not having it has bitten me a few times.<br>I =
>do have the analogous change to the Win32 path code in m3core.<br><br>It is=
> the redundant filenames libfoo.a instead of foo.lib and libfoo.so instead =
>of foo.so?<br>Perhaps. This seems dumb, redundant to me. Why have prefixes =
>and suffixes?<br>Don't suffixes suffice?<br><br>That all said, I remain con=
>vinced that a useful intermediate or probably endpoint<br>is a toolset that=
> targets Windows using cm3cg, ld, as, but otherwise looks like<br>NT386 as =
>much as possible. MAYBE alter the library names to libfoo.*.<br><br>sh and =
>make are needed for building cm3cg.<br>I did use Cygwin for that. MinGWin s=
>ounds promising here too but I haven't tried.<br><br> - Jay<br><br><br=
> /><hr />Get the power of Windows + Web with the new Windows Live. <a href=
>=3D'http://www.windowslive.com?ocid=3DTXT_TAGHM_Wave2_powerofwindows_012008=
>' target=3D'_new'>Get it now!</a></body>
></html>=
>
>--_d0659847-2f20-454a-9665-5df3b5ce2832_--



More information about the M3devel mailing list