Platform independence

new topic     » topic index » view thread      » older message » newer message

I am continually aware as I write my code for Linux how some of it probably
won't work when I go back home and want to run it on DOS. There are a number
of significant differences which cannot be covered in the intepreter, such as
file system delimeters (\ on DOS, / on Unix, : on Mac) and command line
option/file distinguisher (/ on DOS, - on Unix)

I want to be able to write Euphoria code that is write once run anywhere, like
the philosophy behind Java, and I think we need a standard include file that
does all this for us.

So far I have developed this code :

-----------------------------

include misc.e

function iif(integer logical, object tr, object fa)
    if logical then
        return tr
    else
        return fa
    end if
end function

global constant DIV=iif(platform()=LINUX,'/','\\'),
                OPTION=iif(platform()=LINUX,'-','/')

-----------------------------

This code is an absolutely ghastly hack and could be done much more
cleanly but demonstrates my idea. I am sure other people can think of
different incompatibilities which ought to go in.

Because of its interpreted nature Euphoria can offer 'run anywhere' better
than even ANSI C. I would like to see EU for DOS and Linux be the same
thing, not different implementations on different platforms, I also think
this makes Eu much more saleable.

Daniel

--

Daniel Johnson               Engineer, smartypants and clown
Jesus College, Cambridge     all at a very reasonable price
dpj22 at cam.ac.uk
zeus.jesus.cam.ac.uk/~dpj22  talk dpj22 at jewish.jesus.cam.ac.uk

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu