Changes between Version 1 and Version 2 of ObjectiveC/ForeignDeclarations


Ignore:
Timestamp:
Jan 13, 2009 5:02:51 AM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ObjectiveC/ForeignDeclarations

    v1 v2  
    33= Haskell Objective-C FFI: Foreign Declarations =
    44
    5 Objective-C is a proper superset of plain C.  Consequently, we want all the Haskell FFI foreign declarations for C unchanged when dealing with Objective-C.  ['''FIXME:''' ''We can achieve this in two ways: (1) Mix foreign declarations with the 'ccall' calling convention with those with the 'objc' calling convention or (2) promote all existing 'ccall' conventions to be usable with 'objc', too.''  '''Which should we choose?''']
     5Objective-C is a proper superset of plain C.  Consequently, we want all the Haskell FFI foreign declarations for C unchanged when dealing with Objective-C.  They use the `ccall` calling convention as usual.  In addition, we introduce the new `objc` calling conventions for new declarations specific to Objective-C.
    66
    7 '''Incomplete''' list of new declarations:
    8  * foreign import for selector
     7== Summary of foreign declarations ==
     8
     9The following declarations specific to Objective-C:
     10 * Import an ObjC class (may be defined in Haskell):
    911{{{
    10 foreign import objc "@selector <selector name>" var :: <type>
     12foreign class objc "<optional header> <optional implementation> <class name>" tycon
    1113}}}
    12   there can be more than one foreign import decl for one selector (and they can have different types)
    13  * foreign label (or equiv) for shared objects
    14  * foreign export for subclasses??
     14  The newly introduced type `tycon` can be marshalled to and from ObjC land; i.e., it is a ''foreign type'' in the sense of Section 3.2 of the Haskell FFI.
     15 * Import of an ObjC selector (maybe synthesized from a property):
     16{{{
     17foreign import objc "<optional synthesize> <selector>" varid :: <type>
     18}}}
     19  there can be more than one foreign import declaration for one selector with different Haskell identifiers and types.
     20 * Export of a method implementation:
     21{{{
     22foreign export objc "<optional header> +/-[<class> <selector>]" varid :: <type>
     23}}}