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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C0274BC57 for ; Thu, 19 Aug 2010 15:14:18 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As8BAH/KbEzRVaC0kGdsb2JhbACgVQgVAQEBAQkJDAcRAx+haYkYghOGRi6IVAEBAwWFMgSJcQ X-IronPort-AV: E=Sophos;i="4.56,233,1280700000"; d="scan'208";a="57556639" Received: from mail-gy0-f180.google.com ([209.85.160.180]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Aug 2010 15:14:18 +0200 Received: by gye5 with SMTP id 5so733078gye.39 for ; Thu, 19 Aug 2010 06:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4ZCEeBxYiLs0GlGnQibBYffaAs48Ljd76riFAeimFuI=; b=CSMO0B+whA/XwPK2EuVvywAyq3KlnQFrpanGqhwuia0MlIM13DbBdr1wpTAKyEXCIS QNe+MxbAc3L8sgVBlBMTcwPTmF+q6KSbouCnwyeIgSiSeA0QmsX4JC9/L0AxjQG/NCCa Mqzq6nGT+JGDxq2PrjbfoX1CNoxrfWPQpeehg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=hti8z3Iw0XQLx+HNF4S/Ff+Nj6paj3KoyByy6U01nPmDuvorPE3mVxwpXiC5YXpJTd hleVuOnCHvi5F9A2VNlNEe2E4ktjkzGqsjSZsPr+LHhW9HPntANVLGJDBAnc/PRv/aLZ nJROhVIKv4d1zSXgXlr9UGotKHkSTCHYqh/JI= MIME-Version: 1.0 Received: by 10.229.2.3 with SMTP id 3mr345941qch.266.1282223657605; Thu, 19 Aug 2010 06:14:17 -0700 (PDT) Received: by 10.229.31.139 with HTTP; Thu, 19 Aug 2010 06:14:17 -0700 (PDT) In-Reply-To: References: Date: Thu, 19 Aug 2010 15:14:17 +0200 Message-ID: Subject: Re: [Caml-list] Question about float refs. From: Lukasz Stafiniak To: Ethan Burns Cc: caml-list@yquem.inria.fr, Wheeler Ruml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; lukasz:01 mutable:01 ocaml:01 pervasives:01 mutable:01 unboxed:01 foo:01 burns:98 burns:98 polymorphic:01 polymorphic:01 wrote:01 caml-list:01 defined:02 seems:03 On Thu, Aug 19, 2010 at 1:52 PM, Ethan Burns wrote: > Hello, > > I noticed a strange behavior when using references to floating point > values. =A0My suspicion, initially, was that the references would not be > boxed because they are the same as a record with a single mutable > field that is of type float. =A0It seems that OCaml still boxes float > refs. Note that refs are just a standard polymorphic type defined in Pervasives: type 'a ref =3D { mutable contents : 'a ; } Being polymorphic, the "float ref" are not unboxed: imagine what would happen when you passed them to a function foo : 'a ref -> 'a list =3D fun x -> [ !x ] or similar (with a negative occurrence of polymorphic ref).