Changes between Version 6 and Version 7 of ObjectiveC/ForeignDeclarations


Ignore:
Timestamp:
Apr 23, 2012 5:32:57 AM (3 years ago)
Author:
amarqueslee
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ObjectiveC/ForeignDeclarations

    v6 v7  
    2323 * Import an ObjC constructor:
    2424{{{
    25 foreign import classConstructor objc "<constructor method name>" initializer
     25foreign import constructor objc "<constructor method name>" initializerName
    2626}}}
    27  Note that for Objective-C we can get away without a separate constructor by calling methods on classes. However, it's a nice-to-have as part of bridging to OO languages. Perhaps we can also build in memory management for objects returned from these tagged constructors...
     27 Note that for Objective-C we can get away without a separate constructor by calling methods on classes. However, it's a nice-to-have as part of bridging to OO languages. Ambitiously, perhaps we could also build in memory management for objects returned from these tagged constructors...
    2828
    2929=== Export ===
    3030 * Export a set of Haskell functions (pertaining to a certain datatype) as a class:
    3131{{{
    32 foreign export class objc tycon "<superclass>" <list of initializer> <list of method>
     32foreign export constructor objc tycon "<superclass>" <list of initializer> <list of method>
    3333}}}
    3434 The Haskell-defined `tycon` would be type-constrained to have certain properties (yet to be specified). `initializer`s are used to provide constructors of the form
     
    3636... -> IO tycon
    3737}}}
    38  and `method`s look like
     38 * Export of a method implementation:
    3939{{{
    40  ObjCPtr super -> tycon -> ... -> IO (tycon, b)
     40foreign export method objc "<optional header> +/-[<class> <selector>]" varid :: <type>
     41}}}
     42  where
     43{{{
     44varid :: ObjCPtr super -> tycon -> ... -> IO (tycon, b)
    4145}}}
    4246 This approach would pull in `superclass` as a side-effect, and client code could work with it, for now pretending it's some unrelated class. This should give method implementations an Objective-C feel.
    43  * Export of a method implementation:
    44 {{{
    45 foreign export objc "<optional header> +/-[<class> <selector>]" varid :: <type>
    46 }}}
     47
     48In both of these cases, the underlying structure of the class' datatype - if possible - should be derived from the provided type constructor.