FFI, safe vs unsafe

Claus Reinke claus.reinke at talk21.com
Wed Apr 12 19:03:25 EDT 2006

if I may repeat myself (again), since my old suggestion now seems to
agree with Wolfgang, Ross, and Simon:

    so my suggestion would be to make no assumption about
    unannotated calls (don't rely on the programmer too much;),
    and to have optional keywords "atomic" and "non-reentrant".

but yes, "non-reentrant" is rather too long - perhaps "external" (is outside
Haskell and stays out)?

    foreign import - we don't know anything, some implementations
                            might not support this
    foreign import atomic - function is neither blocking nor long-running
    foreign import external - function has no callbacks to Haskell


Wolfgang Thaller:
|Personally, I'm still in favour of inverting this. We are not in  
|court here, so every foreign function is guilty until proven  
|innocent. Every foreign function might be "longrunning" unless the  
|programmer happens to know otherwise. So maybe... "returnsquickly"?

> On 2006-04-11, Ross Paterson <ross at soi.city.ac.uk> wrote:
>> On Tue, Apr 11, 2006 at 09:13:00AM +0100, Simon Marlow wrote:
>>>  - the default should be... concurrent reentrant, presumably,
>>>    because that is the safest.  (so we need to invert the notation).
>> I think the name "concurrent" has a similar problem to "safe": it
>> reads as an instruction to the implementation, rather than a
>> declaration by the programmer of the properties of a particular
>> function; as Wolfgang put it, "this function might spend a lot of
>> time in foreign lands". 
> I'd like to second this.

I agree.  So other suggestions?  longrunning?  mightblock or mayblock?

I don't much like 'nonreentrant', it's a bit of a mouthful.  Any other
suggestions for that?  nocallback?

Haskell-prime mailing list
Haskell-prime at haskell.org

More information about the Haskell-prime mailing list