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.4 required=5.0 tests=DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 7A688BBAF for ; Mon, 18 May 2009 05:27:59 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsFAG1yEErB/BerdWdsb2JhbACXVwEKDAkJEQO2IIQBBQ X-IronPort-AV: E=Sophos;i="4.41,208,1241388000"; d="scan'208";a="40126842" Received: from smtp1e.orange.fr ([193.252.23.171]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 May 2009 05:27:59 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1e01.orange.fr (SMTP Server) with ESMTP id 45F028000091 for ; Mon, 18 May 2009 05:27:58 +0200 (CEST) Received: from wwinf1e35 (wwinf1e35 [10.232.35.109]) by mwinf1e01.orange.fr (SMTP Server) with ESMTP id 3BA16800008E for ; Mon, 18 May 2009 05:27:58 +0200 (CEST) X-ME-UUID: 20090518032758244.3BA16800008E@mwinf1e01.orange.fr From: Vincent Cheval Reply-To: Vincent Cheval To: caml-list@yquem.inria.fr Message-ID: <9493703.159904.1242617278198.JavaMail.www@wwinf1e35> Subject: Static Function in Class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [124.154.253.129] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| Date: Mon, 18 May 2009 05:27:58 +0200 (CEST) X-Spam: no; 0.00; ocaml:01 ocaml:01 val:01 val:01 int:01 int:01 define:02 defined:02 declaration:02 static:03 static:03 let:03 vincent:07 vincent:07 definition:07 Hi, I have a question about Object in Ocaml. I wonder if it's possible to create static function in the definition of a object in Ocaml. Here is a small exemple : Assume that you have this class definition: #class test (n:int) = # object # val x = n # method get_x = x # end;; # #let equal (t_1:test) (t_2:test) = t_1#x = t_2#x;; This class and the function are well defined but I would like not to use the method "get_x" and define my class like that : #class test (n:int) = # object # val x = n # method equal (t_1:test) (t_2:test) = t_1#x = t_2#x # end;; If we were on Java or C++, i should use Static in front of the declaration of "equal". So my question is : Is it possible to do the same thing in OCaml ? Thank You very much... it's my first mail on this mailing list so I hope it's not a boring question. Vincent Cheval