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 NAA10160; Wed, 18 Dec 2002 13:41:32 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA10150 for caml-list@pauillac.inria.fr; Wed, 18 Dec 2002 13:41:31 +0100 (MET) 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 VAA26104 for ; Tue, 17 Dec 2002 21:25:33 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from frankfurt.ucdavis.edu (frankfurt.ucdavis.edu [169.237.104.161]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gBHKPWn26122 for ; Tue, 17 Dec 2002 21:25:32 +0100 (MET) Received: from boson.localdomain.fake (postfix@[128.120.141.218]) by frankfurt.ucdavis.edu (8.11.6/8.11.0/virus-scan-4.0.1) with ESMTP id gBHKPSd28333 for ; Tue, 17 Dec 2002 12:25:28 -0800 (PST) Received: by boson.localdomain.fake (Postfix, from userid 1000) id 7BB52A00C9; Tue, 17 Dec 2002 12:26:18 -0800 (PST) Date: Tue, 17 Dec 2002 12:26:18 -0800 To: OCaml Mailing List Subject: Re: [Caml-list] ocaml embedded scripting language Message-ID: <20021217202618.GA491@boson.ucdavis.edu> References: <3DFCA8EB.13742.2E8F165@localhost> <20021217030244.64549.qmail@web40803.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021217030244.64549.qmail@web40803.mail.yahoo.com> User-Agent: Mutt/1.3.28i From: issac@ucdavis.edu (Issac Trotts) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Eric Merritt wrote: > Everyone, > > > Well I decided to take dans advice and do a simple > forth like implementation. Overall it doesn't seem > like its going to be difficult at all. I have run into > a small snag. As a side note I have already decided > that this is note possible, this is just a last ditch > to see if there is a solution. > > It has to do with the type system more then anything > else. I use a stack to handle data that the > interpreted process is manipulating. I provide a > specific set of words that this forth like language > will use to manipulate the stack. Of course, stacks > may only be of a single type 'a. So if declare a new > type to be > > type some_type = Int of int | Float of float | Word > of string > > Them my stack is some_type Stack.t > > Ok this is all fine and dandy, until a few months > from now when I want to add a new type say File of > Unix.file_descr. The word implementations to support > the new type wouldn't actually be a problem. However, > extending the type seems to be impossible. > > The only way I can see to do this at the moment is to > modify the type and recompile the whole system. That OCaml can be used as a scripting language, so this doesn't have to be a problem. Just use the #load, #directory, and #use toplevel directives, and little or no compiling is necessary. However this seems to require restructuring the program, so maybe it won't be worth it. Another way would be to have a facility for adding new types within your extension language. If you add a start-up file (something like ~/.my_extension_lang_rc) then you can load all your favorite types whenever it runs. Issac ------------------- 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