From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 5BE67BC37 for ; Sun, 8 Nov 2009 18:29:43 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An8AAG+O9kpCbwQckWdsb2JhbACEcZcDAQEBAQkLCgcTBK1OjyQGgTKCOFQ X-IronPort-AV: E=Sophos;i="4.44,704,1249250400"; d="scan'208";a="37744041" Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by mail3-smtp-sop.national.inria.fr with ESMTP; 08 Nov 2009 18:29:42 +0100 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 8BD0BBDE97; Sun, 8 Nov 2009 12:29:41 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 08 Nov 2009 12:29:41 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=J/17r8JzKOzY1wAr+JQuRZVwbfo=; b=C47F+F6wda23HT6qDYe74G2cu0UxqbJThEkipAjYCE32O91QgYNyDX7vAfM2GwXSbmPeCgf2lBYIzRYAc4/7QT0Ywzj8NCxwCZURCWX8/p54Odnh63qpXknibNuBnX6ebybVGJ3UCfBDMyONuTgJ1XHL8AXJ5BTGiEV9wija5bY= X-Sasl-enc: YJWn/RXEbld8v4/o1/v6V7RWELiX4kz7c7yZ09tJjeVI 1257701381 Received: from [192.168.1.14] (ALyon-157-1-135-142.w90-42.abo.wanadoo.fr [90.42.30.142]) by mail.messagingengine.com (Postfix) with ESMTPSA id E85951FD84; Sun, 8 Nov 2009 12:29:40 -0500 (EST) Message-ID: <4AF6FFED.2060900@ens-lyon.org> Date: Sun, 08 Nov 2009 18:29:17 +0100 From: Martin Jambon User-Agent: Thunderbird 2.0.0.22 (X11/20090908) MIME-Version: 1.0 To: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unboxed float tuples References: <91a3da520911080801w6637b652w94a717a830b1c5bd@mail.gmail.com> In-Reply-To: <91a3da520911080801w6637b652w94a717a830b1c5bd@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; ens-lyon:01 unboxed:01 unboxed:01 runtime:01 1.0:98 1.0:98 polymorphic:01 wrote:01 caml-list:01 functions:01 tuples:01 tuples:01 int:01 int:01 jambon:01 Daniel Bünzli wrote: > Tuples and records are represented the same way. However when it comes > to records with only floats fields we get a special unboxed > representation. > > Why don't we get that for tuples of floats only ? Because polymorphic functions like fst would break (or would require extra runtime checking). Note that ('a * 'b) is pretty much the same as: type ('a, 'b) tuple = { a : 'a; b : 'b } # Obj.tag (Obj.repr { a = 1.0; b = 1.0 });; - : int = 0 # Obj.tag (Obj.repr (1.0, 1.0));; - : int = 0 whereas: # Obj.tag (Obj.repr { Complex.re = 1.0; im = 1.0 });; - : int = 254 Martin -- http://mjambon.com/