 USING: alien alien.c-types alien.compiler
 arrays assocs combinators compiler inference.transforms kernel
 math namespaces parser prettyprint prettyprint.sections
-quotations sequences strings words cocoa.runtime io macros ;
+quotations sequences strings words cocoa.runtime io macros
+memoize ;
 IN: cocoa.messages
 
 : make-sender ( method function -- quot )

    swap second length 2 - make-dip ;

MACRO: (send) ( selector super? -- quot )
    [
        >r dup lookup-method r>
        [ make-prepare-send % ] 2keep
        super-message-senders message-senders ? get at ,
    ] [ ] make ;

: send ( args... receiver selector -- return... ) f (send) ; inline


    \ >r <repetition> >quotation -rot
    \ r> <repetition> >quotation 3append ;

MEMO: make-prepare-send ( selector method super? -- quot )
    [
        [ \ <super> , ] when
        swap cache-selector , \ selector ,
