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 AAA25193; Thu, 16 May 2002 00:22:52 +0200 (MET DST) 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 AAA25240 for ; Thu, 16 May 2002 00:22:51 +0200 (MET DST) Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.25.148.40]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g4FMMmH19389 for ; Thu, 16 May 2002 00:22:49 +0200 (MET DST) Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id g4FMMkXt027723; Thu, 16 May 2002 08:22:46 +1000 (EST) Received: from ozemail.com.au (ppp60.dyn144.pacific.net.au [210.23.144.60]) by wisma.pacific.net.au with ESMTP id IAA12445; Thu, 16 May 2002 08:22:43 +1000 (EST) Message-ID: <3CE2DFAF.4070201@ozemail.com.au> Date: Thu, 16 May 2002 08:22:39 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: markus@oefai.at CC: caml-list@inria.fr Subject: Re: [Caml-list] Turning off type-checking References: <20020513133102.GB9777@kiefer.ai.univie.ac.at> <20020514233326Q.garrigue@kurims.kyoto-u.ac.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Jacques Garrigue wrote: >> >>It would be really nice if there were some command-line flag for the >>OCaml-compilers which turns off every check that is not required under the >>assumption that the given OCaml-code is (type) correct as is guaranteed in >>my case. Would this be easily possible? What else could I do to reduce the >>amount of work the OCaml-compiler has to do? Insert Obj.magic everywhere? >> >One thing you might want to try is to write your own interpreter for >your subset of ocaml. > Heh. Or just use Felix! Felix doesn't do Hindley-Milner type inference, so the problem should go away. It does a restricted form of type deduction (bottom up only ..) http://felix.sourceforge.net Here is the output and your model encoded as Felix script. Your code generator only needs tiny tweaks to make it generate Felix. --- run the script below ------ [skaller@pelican] ~/links/flx>./bin/flx --test ttt TESTMODE: running felix from current directory Very Very High --- ttt.flx ------------------------ #include union satisfaction = | Low | High | Very of satisfaction; union diameter = | Large | Small; union sort = | Mozzarella | Gorgonzola; union topping = | Cheese of sort | Tomatoes | Mushrooms; union spiced = | False | True; union meal = | WienerSchnitzel of diameter | Pizza of (diameter * spiced * topping) | TapirSoup of spiced; fun model (meal_d1:meal):satisfaction = let satisfaction_c1 = match meal_d1 with | TapirSoup ?spiced_d1 => match spiced_d1 with | True => Low | False => High endmatch | Pizza (_, ?spiced_d1, ?topping_d1) => let satisfaction_c1 = match spiced_d1 with | True => match topping_d1 with | Cheese ?sort_d1 => match sort_d1 with | Gorgonzola => Low | Mozzarella => High endmatch | _ => High endmatch | False => Low endmatch in Very satisfaction_c1 | WienerSchnitzel _ => Low endmatch in Very satisfaction_c1 ; fun string_of(x:satisfaction)= match x with | Low => "Low" | High => "High" | Very ?z => "Very " + string_of z endmatch ; val MyMeal = Pizza (Large,True, Cheese Mozzarella); print (string_of (model MyMeal)); endl; -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- 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