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 8D842BC57 for ; Mon, 7 Jun 2010 21:56:53 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkECAOvrDEzRVaE0mGdsb2JhbACeFggVAQEBAQEICQwHESKvcoIBhVguiE8BAQMFglSCPgSODQ X-IronPort-AV: E=Sophos;i="4.53,380,1272837600"; d="scan'208";a="51926797" Received: from mail-fx0-f52.google.com ([209.85.161.52]) by mail3-smtp-sop.national.inria.fr with ESMTP; 07 Jun 2010 21:56:53 +0200 Received: by fxm19 with SMTP id 19so2025963fxm.39 for ; Mon, 07 Jun 2010 12:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type; bh=kV2bPn/Z99ksfPDMxxSLZKwU8Lue9jU+SpwskhChGHE=; b=XKbnihr8EaBnlgNEQc9DoYL7L1nU6PCCDtDo32ViC/F/6hdA67z43CvhpCGhTEWZHq 12RpTqA+FWdLyRV0X5WRyHpP78FaQ0R7ZGu1WhNOxSIdmy4oiIcY/9EGwgZ8ZblVlYYb xOJNJtlry1aLzRkIu67cQi7tDoNQz4yzcM41I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=Uv2g0a80l76ABGCKd6TQP484VLOmKdWiCPvfzLkp9M0G/Qpb99jCjqhBALkVR9FCFx a5BMCGc8E3+pYVqnDbyqriw3V3kS6WOafW6r0obDzjexF0e6iLl1ItSJhdXAzk1yqYJv MTWy+YlRk9exBJAAYyslidIu222AqI48bQEvc= Received: by 10.204.46.205 with SMTP id k13mr6966985bkf.143.1275940612410; Mon, 07 Jun 2010 12:56:52 -0700 (PDT) MIME-Version: 1.0 Sender: gabriel.scherer@gmail.com Received: by 10.204.112.14 with HTTP; Mon, 7 Jun 2010 12:56:32 -0700 (PDT) In-Reply-To: <4C0D4C88.4070102@gmail.com> References: <4C0D3557.1020200@gmail.com> <010d01cb0672$09f3eb90$1ddbc2b0$@romulus.metastack.com> <4C0D4C88.4070102@gmail.com> From: bluestorm Date: Mon, 7 Jun 2010 21:56:32 +0200 X-Google-Sender-Auth: 5dGj-l-CMCwSEfnk-ZCKaK8wrns Message-ID: Subject: Re: [Caml-list] Converting variants with only constant constructors to integers To: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= Cc: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016e6dcd277f50fad048876129a X-Spam: no; 0.00; variants:01 constructors:01 integers:01 foo:01 integers:01 foo:01 compiler:01 segfaults:01 compiler:01 segfaults:01 caml-list:01 constructor:01 constructor:01 unsafe:01 unsafe:01 --0016e6dcd277f50fad048876129a Content-Type: text/plain; charset=ISO-8859-1 Beware that "%identity" is an unsafe feature that breaks all safety guarantees if used badly. If you were, for example, to change your definition of "foo" (in a way not always representable as integers, such as adding a constructor with parameters), int_of_foo would become incorrect. The compiler wouldn't warn you, and you could get pretty bad failures (segfaults). You're on your own. --0016e6dcd277f50fad048876129a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Beware that "%identity" is an unsafe feature that breaks all safe= ty guarantees if used badly.

If you were, for example, to change you= r definition of "foo" (in a way not always representable as integ= ers, such as adding a constructor with parameters), int_of_foo would become= incorrect. The compiler wouldn't warn you, and you could get pretty ba= d failures (segfaults). You're on your own.

--0016e6dcd277f50fad048876129a--