From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id CAA7B7EFC0 for ; Wed, 23 Dec 2015 04:57:31 +0100 (CET) IronPort-PHdr: 9a23:vXhN9BzXzbAQHYHXCy+O+j09IxM/srCxBDY+r6Qd0ekVIJqq85mqBkHD//Il1AaPBtWFraocw8Pt8IneGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwudrqzQtaapv/0/t7x0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe1XwWR1OQDbxE6ktY/jtKJkptyoQ7p17N9bUaj8V6IlQaAeATg7dWszsp7Frx7GGCmC6HVUd2gXiQZFGUCR6hj8V5TwmiT/v+t5niKdOJulHvgPRT2+4vIzG1fTgyAdOmth/Q== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nanaki@gmail.com; spf=Pass smtp.mailfrom=nanaki@gmail.com; spf=None smtp.helo=postmaster@mail-lb0-f180.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nanaki@gmail.com) identity=pra; client-ip=209.85.217.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nanaki@gmail.com"; x-sender="nanaki@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of nanaki@gmail.com designates 209.85.217.180 as permitted sender) identity=mailfrom; client-ip=209.85.217.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nanaki@gmail.com"; x-sender="nanaki@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f180.google.com) identity=helo; client-ip=209.85.217.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nanaki@gmail.com"; x-sender="postmaster@mail-lb0-f180.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CjAAArG3pWm7TZVdFeDoRrBoxLnXcGhA2EU4w1hg0CgSMHPBABAQEBAQEBARABAQEBAQYLCwkhLkEMgWCBfgoBAQMBEhEdARsdAQMBCwYDAgMBBzcCAiIBEQEFARwGEyKHdwEDCgiQHI9OgTE+MYtIgWqCeYhgChknDVaDHwEBAQEGAQEBAQEBFwEFDoYAhUeHc4FKBY4uiFSNTI55jG4SJIEXOYIvI4EfXx00g0qBXgEBAQ X-IPAS-Result: A0CjAAArG3pWm7TZVdFeDoRrBoxLnXcGhA2EU4w1hg0CgSMHPBABAQEBAQEBARABAQEBAQYLCwkhLkEMgWCBfgoBAQMBEhEdARsdAQMBCwYDAgMBBzcCAiIBEQEFARwGEyKHdwEDCgiQHI9OgTE+MYtIgWqCeYhgChknDVaDHwEBAQEGAQEBAQEBFwEFDoYAhUeHc4FKBY4uiFSNTI55jG4SJIEXOYIvI4EfXx00g0qBXgEBAQ X-IronPort-AV: E=Sophos;i="5.20,467,1444687200"; d="scan'208";a="158063887" Received: from mail-lb0-f180.google.com ([209.85.217.180]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 23 Dec 2015 04:57:30 +0100 Received: by mail-lb0-f180.google.com with SMTP id pv2so54711952lbb.1 for ; Tue, 22 Dec 2015 19:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uZ1FBAExnylTeyqLu8XH7SfJEu6Z1c4+IpLd54SQui0=; b=tj9oi9sLODdi7Stbge/ieoEEGO45aL0OgmjU4oEimVgf//W+iRkMcaS2j+GcPjVn/y /WlThoE9ONyhZYklEDQw6OhP4C0mmK793TwFdjnsBt6bIHZOaVpm9gLtmsBYcP2WPkAK ODB61+YI0qUoYaqIy0bgrfKyx4qsoV+EDI9B2/rUrFirQRkzCeWmqwd3r2veZARXekd7 0fc5SVkZp2CuN0XAgerWU/yLY7QqtXIP92HbP5zf8B2ePeP10z9HOb/ED/EmkANBszQh ItZ+HWoUkoMU5eFuTs9T/smcDBD3D/m53I21qkgFEKmddULOKqaHxQLQDS1tAC+Hefd9 xVLg== MIME-Version: 1.0 X-Received: by 10.112.141.201 with SMTP id rq9mr9508126lbb.4.1450843049887; Tue, 22 Dec 2015 19:57:29 -0800 (PST) Received: by 10.25.16.202 with HTTP; Tue, 22 Dec 2015 19:57:29 -0800 (PST) In-Reply-To: <54dde531.10d.151cc657e75.Coremail.syshen@nudt.edu.cn> References: <54dde531.10d.151cc657e75.Coremail.syshen@nudt.edu.cn> Date: Tue, 22 Dec 2015 19:57:29 -0800 Message-ID: From: Jeff Meister To: =?UTF-8?B?5rKI6IOc5a6H?= Cc: caml-list Content-Type: multipart/alternative; boundary=001a11c38b5a9d11a3052788b82c Subject: Re: [Caml-list] what is the application of class ref? --001a11c38b5a9d11a3052788b82c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The "built in" type 'a ref is implemented using a record with a mutable field. This example from the manual is simply showing you how to implement references using an object with a mutable instance variable instead. There is no language construct "class ref", you are just defining a class that happens to be named "ref". Since "ref" is just a normal identifier, not a keyword, this is allowed. On Tuesday, December 22, 2015, =E6=B2=88=E8=83=9C=E5=AE=87 wrote: > Dear all: > > In ref manual of ocaml "3.10 Parameterized classes", there is a code > segment liek this: > > class ref (x_init:int) =3D > object > val mutable x =3D x_init > method get =3D x > method set y =3D x <- y > end;; > > so what is the meaning of class ref? > > > Shen > --001a11c38b5a9d11a3052788b82c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The "built in" type 'a ref is implemented using a record with= a mutable field. This example from the manual is simply showing you how to= implement references=C2=A0using an object with a mutable instance variable= instead. There is no language=C2=A0construct "class ref", you ar= e just defining a class that happens to be named "ref". Since &qu= ot;ref" is just a normal identifier, not a keyword, this is allowed.
On Tuesday, December 22, 2015, =E6=B2=88=E8=83=9C=E5=AE=87 <syshen@nudt.edu.cn> wrote:
Dear all:

In ref manual of ocaml "3.10= Parameterized classes", there is a code segment liek this:

cla= ss ref (x_init:int) =3D
object
val mutable x =3D x_init
method get= =3D x
method set y =3D x <- y
end;;

so what is the meaning= of class ref?


Shen
--001a11c38b5a9d11a3052788b82c--