dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]pnetlib platform dep?


From: Rhys Weatherley
Subject: Re: [DotGNU]pnetlib platform dep?
Date: Mon, 11 Mar 2002 08:05:11 +1000

S11001001 wrote:

> What I'm really asking here includes other things. For example,
> System.Uri.IsBadFileSystemCharacter is also something like that.

System.IO.Path -> InvalidPathChars is what you're looking for.

> Things
> like threading support rely on native calls. However, C# can, with the
> help of the compiler, TECHNICALLY handle some things by itself.
>
> For example, because we have preprocessor, I could do with this:
>
> #if defined(WINDOWS)
> // check against list of valid windows characters
> #elsif defined(GNU)
> // check against longer list of valid ext2 characters
> #endif

I want to avoid this like the plague in C# code.  The point
of pnetlib is that there is only one library, that can be used
on all platforms.  Compiling different libraries for different
platforms makes the porting problem harder.

A fundamental design goal is that anything that may differ
between platforms should be in the engine, not the library.
Then we only have to port the engine.

#if's should only be used for subsetting.  e.g. the
ECMA_COMPAT macro is used to build a strict
ECMA subset of pnetlib, but that subset is otherwise
platform-neutral.

When it is necessary to implement platform-specific code,
it should be stripped down to its most basic set of operations.
e.g. Platform.FileMethods works on handles, not objects.
This decreases the amount of code needed in the engine.

Extra internalcalls should only be added when there is
no way at all to perform the operation cleanly in C# without
using a #if, or there is a compelling efficiency reason.

I'll think you'll find though, that with the exception of
sockets, you shouldn't need InternalCall's at all in the
"System" assembly where the Uri classes live.

Cheers,

Rhys.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]