Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: