From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 747D6BB84 for ; Thu, 3 Aug 2006 07:13:40 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k735DdE9000378 for ; Thu, 3 Aug 2006 07:13:40 +0200 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 HAA25502 for ; Thu, 3 Aug 2006 07:13:39 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k735DaJf000350 for ; Thu, 3 Aug 2006 07:13:38 +0200 Received: from rosella (ppp15-225.lns2.syd7.internode.on.net [59.167.15.225]) by smtp3.adl2.internode.on.net (8.13.6/8.13.5) with ESMTP id k735DQOc047607 for ; Thu, 3 Aug 2006 14:43:26 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: strict? From: skaller To: "O'Caml Mailing List" Content-Type: text/plain Date: Thu, 03 Aug 2006 15:13:25 +1000 Message-Id: <1154582005.8167.68.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44D18604.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44D18600.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compiler:01 semantics:01 annotations:01 ocaml:01 1.0:98 sourceforge:01 arbitrary:01 functions:01 expression:01 expression:01 precisely:01 pair:01 argument:01 programming:03 depends:04 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 I'm looking for a pair of concepts such as nice function/transparent expression which allow an arbitrary choice of evaluation strategy. A nice function is basically one like 'sin' which is total, has no side effects, depends only on its arguments, and always returns a value. I think this is basically 'total, pure and strict'. A transparent expression is one which can be evaluated at any time, anywhere. For example 'sin 1.0' is the same no matter when and where it is evaluated. More or less an expression is transparent if it is a constant or application of nice functions to transparent arguments. The idea is basically to know when a compiler can choose the evaluation strategy based on performance, without worrying that this will change semantics. More precisely my translator *already* does this .. and I want to know when this is justified (so I can figure out how to give the programmer enough annotations and control to get the result they want, and be able to reason about their code). Note I use the word 'function' in the C (or Ocaml) sense here. Clearly the Wikipedia definition of strict: f(bottom) = bottom is rubbish when applied to a mathematical function like 'sin', since bottom isn't a valid argument, but it makes sense for 'sin' in the programming language sense. -- John Skaller Felix, successor to C++: http://felix.sf.net