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 WAA13027; Tue, 25 May 2004 22:00:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA13434 for ; Tue, 25 May 2004 22:00:45 +0200 (MET DST) Received: from mxout1.cac.washington.edu (mxout1.cac.washington.edu [140.142.32.134]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4PK0iSH031042 for ; Tue, 25 May 2004 22:00:44 +0200 Received: from mailhost1.u.washington.edu (mailhost1.u.washington.edu [140.142.32.141]) by mxout1.cac.washington.edu (8.12.11+UW04.02/8.12.11+UW04.03) with ESMTP id i4PK0deW010431; Tue, 25 May 2004 13:00:39 -0700 Received: from lulu (mobile258.dyn.cs.washington.edu [128.208.7.79]) by mailhost1.u.washington.edu (8.12.11+UW04.02/8.12.11+UW04.03) with ESMTP id i4PK0dKX025969; Tue, 25 May 2004 13:00:39 -0700 Received: from martine by lulu with local (masqmail 0.2.20) id 1BSi4v-0cl-00; Tue, 25 May 2004 12:59:13 -0700 Date: Tue, 25 May 2004 12:59:13 -0700 From: Evan Martin To: dido@imperium.ph Cc: caml-list@inria.fr Subject: Re: [Caml-list] handling forward references in a compiler Message-ID: <20040525195913.GE2304@lulu> References: <20040525095213.GA2655@imperium.ph> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040525095213.GA2655@imperium.ph> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Miltered: at concorde with ID 40B3A5EC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; evan:01 caml-list:01 2004:99 dido:01 undeclared:01 resorting:01 hash:01 evan:01 compiler:01 compiler:01 bindings:01 ocaml:01 wrote:03 imperative:04 wondering:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, May 25, 2004 at 05:52:13PM +0800, dido@imperium.ph wrote: > I'm writing a compiler for a language that allows undeclared forward > references in OCaml, and I'm just wondering how one is supposed to > handle these sorts of things without resorting to imperative features or > multiple passes. Thanks for asking this question. I'm actually stuck on almost the same problem right now. I resorted to doing both: filling out hash tables in an initial pass. I figure that the global namespace is not dynamic--in contrast with locally-scoped bindings--so it's ok to use it imperatively; I never need any version of it except for the final one. In other words, there's only one full, accurate picture of the global namespace (while the local bindings vary from scope to scope), so I might as well take a pass to figure it out completely. But I'm eager to read what others have to say. -- Evan Martin martine@danga.com http://neugierig.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