From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA12916; Tue, 23 Mar 2004 12:57:57 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA12610 for ; Tue, 23 Mar 2004 12:57:55 +0100 (MET) Received: from narury.org (irkki.net [193.65.56.227]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i2NBwTKW014890 for ; Tue, 23 Mar 2004 12:58:29 +0100 Received: (from xm@localhost) by narury.org (8.11.6/8.9.3) id i2NBvn603609 for caml-list@inria.fr; Tue, 23 Mar 2004 13:57:49 +0200 Date: Tue, 23 Mar 2004 13:57:49 +0200 From: Jere Sanisalo To: caml-list@inria.fr Subject: [Caml-list] Basic quation about object methods Message-ID: <20040323135747.A3439@xmunkki.org> Reply-To: xm@xmunkki.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; newbie:01 val:01 params:01 params:01 ocaml:01 mutable:01 int:01 int:01 object:03 object:03 parameters:05 variables:06 i'm:07 i'm:07 clarify:08 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 329 Hi, I'm a relatively newbie ocaml user, and I'm currently trying to understand a basic thing about methods. Can someone clarify the following: class test = object val mutable v = 0 method no_params = v<-v+1; print_int v method has_params () = v<-v+1; print_int v end;; Now what's the basic difference between methods "no_params" and "has_params"? The o'reilly book says "Note that some methods do not need parameters" and "We usually access instance variables with parameterless methods.". Still both of these methods work just the same. Thanks for any info. -- Jere Sanisalo [xm@xmunkki.org] - http://www.xmunkki.org/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners