Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] let or val in objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Rogoff <bpr@b...>
Subject: Re: [Caml-list] let or val in objects
One place where you may notice that lets are used is when you have a
bunch of instance variables that depend on other instance variables for
their definition. For instance this code (not checked, posting from
wife's OCamlless machine :()

class foo = object val s = "test" val l = String.length s end

won't compile because of the dependence of l on s.

This example is clearly contrived, but if you do GUI programming this sort
of situation occurs frequently.

-- Brian
-------------------
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