From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id F0F48BC0A for ; Sat, 9 Jun 2007 14:42:36 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l59CgaL8007433 for ; Sat, 9 Jun 2007 14:42:36 +0200 Received: by ug-out-1314.google.com with SMTP id p27so1060530ugc for ; Sat, 09 Jun 2007 05:42:36 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=nMnTDakcvh3v5UokvZG5883Za9bA6a25zyIF1y3ZkeNKvjL/jUv/qo2EuN3bEVfgo1Ygd67v1VLYJ1B8JIxiJRnJ9ob3UXMu50VNTloXDoqiRNMuroM6hY44un+7YSXkBSHCXuUdUMYnz4Nv8McJwu57nXHiHyxLXv6xN7aY15E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=oQcNqB3ffyYtMfCfafhALwlZrQA+9dpVGzmPJjWnJeBYwpAtr+h3jHENWfKP17heqAxJ56tgMibqJLF6edg2thTyGdYzH1EYnWL1hQEpg8ZO+eFj3daXaQWoTnHtjpHo/MDNh1mBcy9i2wtJO9z7pHMkLuHwXqxNZAoidGr6rZU= Received: by 10.67.32.6 with SMTP id k6mr2723229ugj.1181392956370; Sat, 09 Jun 2007 05:42:36 -0700 (PDT) Received: from ?192.168.1.35? ( [81.33.210.207]) by mx.google.com with ESMTP id t58sm2486419ugt.2007.06.09.05.42.35 (version=SSLv3 cipher=OTHER); Sat, 09 Jun 2007 05:42:36 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: Caml List From: Joel Reymont Subject: Camlp4 and Cocoa Date: Sat, 9 Jun 2007 13:42:33 +0100 X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 466AA03C.001 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 466AA03C.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ocaml:01 runtime:01 camlp:01 ocaml:01 cocoa:98 cocoa:98 outlet:98 outlet:98 blog:98 invoke:01 parsed:01 define:01 objective:02 parse:02 I'm trying to figure out how to define Cocoa classes in OCaml. The definition needs to be parsed somehow, to make invoke code that registers the classes with the Objective C runtime. I think camlp4 can be somehow used to parse a regular OCaml class definition and figure out the ObjC based on the types used. Trouble is, I'm not even sure what this would look like. Please let me know if you have any suggestions! I'm including the original ObjC as well as the equivalent Scheme code using the excellent Chicken Scheme Cocoa bridge. Thanks, Joel --- Original Objective-C --- @interface ConverterController : NSObject { IBOutlet id dollarField; IBOutlet id rateField; IBOutlet id totalField; } - (IBAction)convert:(id)sender; @end --- Chicken Scheme --- (define-objc-class ConverterController NSObject ((outlet: amountField) (outlet: dollarField) (outlet: rateField) (outlet: converter)) (- VOID ((convert: ID sender)) (let* ((currency (@ @dollarField float-value)) (rate (@ @rateField float-value)) (amount (@ @converter convert-currency: currency at-rate: rate))) (@ @amountField set-float-value: amount) (@ @rateField select-text: self)))) -- http://topdog.cc - EasyLanguage to C# translator http://wagerlabs.com - Blog