Thinking (again) about an Objective-C bridge

Bruce Mitchener <[email protected]>
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CA+esKjPUaqs6Xtn-0WFdGw-A5UwnRPHE1BAUBv-0x2yHjWcViQ@mail.gmail.com>
One of the issues to solve in doing an Objective-C bridge for Dylan is how
to represent a method invocation on the Dylan side.

In C, we have %call-c-function, which looks like:

    %call-c-function (?name:expression, #key ?c-modifiers:expression = "")
        (?parameters:*) => (?results:*)
      (?arguments:*)
    end;

In LispWorks, they use this sort of syntax:

    (invoke window "close")
    (invoke box "setWidth:height:" 10 20)

In ClozureCL, this is the syntax:

    (send w :set-alpha-value 0.5)
    (send v :mouse p :in-rect r)

In Python:

    anObject.modifyArg_andAnother_(arg1, arg2)

Overall, I like the approach used by ClozureCL as it seems much more
natural and more like the Objective-C that one would see. They've also got
variants of sending to the superclass, sending when a structure is
returned, etc.  Having the keywords and the arguments alternate makes it
nicely readable (much more so than the LispWorks example).

In ClozureCL, a lot of the work is done by macros, but I don't think our
macros in Dylan are powerful enough to do the same work. So what can we get
away with? We don't want a lot of work being done at run-time as we'd like
for this to be as efficient as possible.

My thinking is that we might need a custom converter, much like
%call-c-function has, with the corresponding compiler support.  I'd love to
be proved wrong though, so what thoughts do any of you have on this?

 - Bruce

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.