Again: FFI syntax

Sven Panne Sven_Panne at BetaResearch.de
Mon May 14 07:29:10 EDT 2001


Simon Marlow wrote:
> But now we have all new silly combinations, like
> 
>         foreign export "dynexp" foo :: ...
> and
>         foreign export "dynimp" foo :: ....
> and
>         foreign export "&foo" foo :: ...
> 
> the extent field needs to be separated into import-extent and
> export-extent, I think.

That's exactly what I had in mind.

> Can we make the "static" optional?  It wouldn't introduce any ambiguity,
> and it would save characters in the common case.

Well, it *would* introduce ambiguity (or we steal some names from C land):

   foreign import ccall "dynimp" dynimp :: ...

> I like '&', but I'm less sure about '!' - this feels like we're getting
> a little too cryptic.

The reason for the "cryptic" '!' is avoiding ambiguity. Let's assume we
introduce a modifier which looks like a valid C identifier. What should
the following mean then?

   foreign import ccall "static foo bar" baz :: ...

Is it an import of the C entity "foo" with the #include file "bar", or is
it an import of the C entity "bar" with modifier "foo"? An alternative
would be to make the include part somehow distinguishable from a C
identifier, but I'm not sure if this would be less cryptical. And '!' is
not that bad IMHO, the connotation "DANGER" should be obvious, and a single
character doesn't clutter up the extent.

*sigh* Syntax wars again...    :-}

Cheers,
   Sven
-- 
Sven Panne    Fon: +49/89/99567000    Fax: +49/89/99567461
BetaResearch GmbH,    Betastr. 1,    D-85774 Unterfoehring
mailto:Sven_Panne at BetaResearch.de    http://www.betaresearch.de




More information about the FFI mailing list