[M3devel] exposing both path name types?
Jay
jayk123 at hotmail.com
Sun Feb 24 01:34:13 CET 2008
Oh I think I see some of how to do this.
Olaf's path stuff is actually implemented, maybe just not exposed, and perhaps incomplete, but it demonstrates a "trick" of Modula-3.
You can do this:
INTERFACE I;
PROCEDURE F1();
PROCEDURE F2();
END I;
MODULE A EXPORTS I;
PRODEDURE F1() = ... END F1;
MODULE B EXPORTS I;
PRODEDURE F2() = ... END F2;
The implementation of interface can be distributed among multiple modules.
To export an interface just means to implement some or all of it. Usually but not necessarily all.
(I wonder what if you implement none of it?)
That helps much.
It doesn't provide a complete idiom I think for what I ask, but it is a start.
I suspect generics help here.
But I'm still not sure what the entire answer is.
- Jay
From: jayk123 at hotmail.comTo: m3devel at elegosoft.comDate: Sun, 24 Feb 2008 00:22:29 +0000Subject: [M3devel] exposing both path name types?
What is the idiom for this: Currently:There is Pathname.i3.PathnamePosix EXPORTS PathnamePathnameWin32 EXPORTS PathnameYou can only have one in a link. It would seem possibly useful to have:Pathname.i3 unchangedPathnamePosix.i3 identical to Pathname.i3 (some what to avoid the duplication?)PathnameWin32.i3 identical to Pathname.i3 (ditto) On Posix targets: PathnameWin32.m3 exports just PathnameWin32 PathnamePosix exports both PathnamePosix and Pathname On Windows targets: PathnamePosix exports just PathnamePosix PathnameWin32 exports both PathnameWin32 and Pathname That is Pathname.Foo resolves statically at compile time to the target-specific library.PathnameWin32.Foo and PathnamePosix.Foo are also both explicitly available. These modules each import nothing, except Text. They do all their string manipulation themselves. Olaf's recent Quake extensions document but don't implement pn_native( pn ) --> text pn_posix( pn ) --> text pn_win( pn ) --> textAs long as pn is a fullpath, these are easy, I just wrote up prototypes, haven't compiled them. I think these functions might suggest doing what I'm asking about as well, maybe.Or maybe you'd just convert and then never pick back apart. I have sleazed by for now by using subst_text / to \ and setting up NTFS junctions.In this way, I can cross build NT386 <=> NT386GNU either host, either target.Had I not done anything, the linker interprets /cygdrive/c/foo/bar.lib as a command switch and says it doesn't understand it.Not a big deal, but I think there might be some easy progress here. This is not just about Pathname. It is also about File.Even though NT386GNU File is FilePosix, it would be useful to allow the serial package to use FileWin32 instead.But FilePosix and FileWin32 both reveal the same types.It'd be nice if they could expose FilePosix.T and FileWin32.T and then only one of them reveal File.T = FilePosix.T or File.T = FileWin32.T, something like that. - Jay
Climb to the top of the charts! Play the word scramble challenge with star power. Play now!
_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080224/dcc3a02e/attachment-0002.html>
More information about the M3devel
mailing list