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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 73A0ABC69 for ; Thu, 2 Aug 2007 11:59:00 +0200 (CEST) Received: from ctsmtpout3.frontal.correo (smtp.telefonica.net [213.4.149.66]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l729wxjJ022139 for ; Thu, 2 Aug 2007 11:59:00 +0200 Received: from tux-chan (83.32.14.179) by ctsmtpout3.frontal.correo (7.2.056.6) (authenticated as ferferse$telefonica.net) id 46AD035A00091661; Thu, 2 Aug 2007 11:58:58 +0200 Received: from batsman by tux-chan with local (Exim 3.36 #1 (Debian)) id 1IGXSL-0005IR-00; Thu, 02 Aug 2007 11:58:57 +0200 Date: Thu, 2 Aug 2007 11:58:57 +0200 From: Mauricio Fernandez To: jos@catnook.com, caml-list@inria.fr Subject: Re: [Caml-list] undefined symbol `caml_tuplify2' in dynamic rocaml extension (UPDATE) Message-ID: <20070802095857.GD21868@tux-chan> Mail-Followup-To: jos@catnook.com, caml-list@inria.fr References: <20070801040102.GA88101@lizzy.catnook.local> <20070801091647.GB31718@tux-chan> <20070801161702.GA28680@lizzy.catnook.local> <20070801175907.GA29353@lizzy.catnook.local> <20070801232405.GB29353@lizzy.catnook.local> <20070802092050.GC21868@tux-chan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070802092050.GC21868@tux-chan> User-Agent: Mutt/1.5.11 Sender: =?iso-8859-1?Q?Mauricio_Julio_Fern=E1ndez_Pradier?= X-Miltered: at concorde with ID 46B1AAE4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 val:01 segfaults:01 compile-time:01 foo:01 recursive:01 foo:01 wrote:01 caml-list:01 undefined:01 pair:01 variant:02 variant:02 tuple:02 tuple:02 On Thu, Aug 02, 2007 at 11:20:50AM +0200, Mauricio Fernandez wrote: > > It looks like we are really close. The next (final?) issue is that we have a > > function with signature > > > > val eval : kpp -> string -> value list -> value list > > > > where > > > > type value = > > | Vstr of string > > | Vtup of value list > > > > which we want to export to Ruby. We tried: > > > > Interface.generate(EXT_NAME) do > > value = sym_variant("value") do |t| > > non_constant :Vstr, STRING > > non_constant :Vtup, LIST(t) > > end > [...] > > but it doesn't work (it segfaults inside the extension). > > > > How does one represent `value' on the Ruby side? > > I think you have to wrap the LIST(t) in a TUPLE(): > > value = sym_variant("value") do |t| > non_constant :Vstr, STRING > non_constant :Vtup, TUPLE(LIST(t)) > end > > I'll try to either auto-detect this or perform a compile-time check. Ignore that; I forgot that rocaml already detects when such extra boxing is needed and performs it automatically, so non_constant :Vtup, LIST(foo) should work already. It can't be due to the type being recursive either because that works fine in the tree example. Just to make sure, are you calling eval as in kpp.eval(str, [[[ :Vtup, [ [[:Vstr, "foo"]] ] ]]]) The outer pair of [ ] because it's a block, the next one because it holds a LIST, then the block represented as [symbol, value] where value is a block holding a list of [symbol, value] blocks. If you've got the wrong number of [ ], maybe the generated extension isn't detecting it, and hence the crash. Yes, it's hard to get the above right, so I'll see if something can be done from Ruby to make it easier. -- Mauricio Fernandez - http://eigenclass.org