On 01-Jun-2000, Antti-Juhani Kaijanaho <[EMAIL PROTECTED]> wrote:
> 
> Like there is no way in Haskell 98 to access OS services beyond a certain
> subset, there is no way in C90 or C99 to access OS services beyond a
> certain subset.  Haskell's subset is actually larger than C's.
> 
> Like Haskell, C has no provisions for accessing code written in other
> languages.
>
> In both languages, if you want to access OS services beyond the
> standardized subset, or if you want to access code written in other
> languages, you need to go beyond the standard and use some things that
> make your programs a little more unportable.

That may be true in some theoretical sense, but in the
real world there are a zillion C libraries like OpenGL, Xlib, etc.,
which have already been ported to all the systems of interest,
and which can be trivially accessed from C.  Furthermore,
these libraries are portable between different C compilers.
For Haskell, there is currently no way of accessing OpenGL, for
example, that is portable between different Haskell compilers.

> Understand this: I am not against improving the FFI of the Haskell
> systems or making their FFIs compatible.  My point is that making the
> FFI part if the language is not necessarily necessary.

In today's world it is often very difficult to write complete
applications in a single language, especially if you want to
use a nice high-level language like Haskell.  The need to make
use of existing libraries written in other languages is so common
that a language which does not provide portable support for this
is severely lacking.  It's not enough to provide non-portable
ways of doing this; that just locks programmers into using a
single implementation.

This need has been recognized by modern programming languages
and modern programming language standards.  The ISO Ada 95 standard,
for example, specifies standardized interfaces from Ada to C, Fortran,
and COBOL.  The 1998 ISO C++ standard requires C++ implementations to
support a C interface.  The Fortran standardization committee have
been working on a standardized interface between Fortran and C
(I don't know the current status of that).  For Java, the Java
Native Interface (JNI) provides a standard interface to C.
For Mercury, the Mercury language reference manual specifies
a C interface that all Mercury implementations must support.

I strongly urge that a standard FFI should be seen as an important
goal for Haskell-2.  If Haskell does not have a standard FFI, then
programmers who are concerned about not being locked into a single
compiler will turn to other languages that do have a standard FFI.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to