From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id CAE23BC69 for ; Tue, 16 Oct 2007 17:20:51 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAZzFEfAXQInh2dsb2JhbACOTgEBAQgKKQ X-IronPort-AV: E=Sophos;i="4.21,284,1188770400"; d="scan'208";a="18095251" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 16 Oct 2007 17:20:51 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9GFKolj016104 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 16 Oct 2007 17:20:51 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAH5zFEfRVYC6mGdsb2JhbACOTgEBAQEHBAYRFg X-IronPort-AV: E=Sophos;i="4.21,284,1188770400"; d="scan'208";a="3110029" Received: from fk-out-0910.google.com ([209.85.128.186]) by mail2-smtp-roc.national.inria.fr with ESMTP; 16 Oct 2007 17:20:50 +0200 Received: by fk-out-0910.google.com with SMTP id z22so2248961fkz for ; Tue, 16 Oct 2007 08:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; bh=Lhld0EbpIZQOTtQD1Y8v1EIGjYVknow89GhsdQNzSFA=; b=iPztxDgUQ9AkdDwhT7fYm3mC7PvsfcfVT6xyjfNkWj8sWDoyNeGshGaj4ZRpL+POV15R79vIgLvOMPv/WVQA01J5pHKUmiumjJLRr6dqZ55Sc4R4YF6+BJpJdMSwXxLRiZCrJ787u4bw8/Hzq3X1qmfEXfSErtlFGVVuQDe7f+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding:sender; b=qpjW5sRjOKM68SZt9EmmUcflTp/soPCCLAxoBMAjuuAz6TIMNcSxdyP1sEhP6yqxmjaGHSWbnwDsulDlDXYhRgf9OVKqNfCZnW6N+dxMqtOEb/KOlzVE/qHGj2rl0cIK2MHjnCxNzL58J1z/HR7UQTqmhRY8rT7HnLvMgXEsMMY= Received: by 10.86.54.3 with SMTP id c3mr5986154fga.1192548050397; Tue, 16 Oct 2007 08:20:50 -0700 (PDT) Received: from ?172.23.197.254? ( [195.221.38.254]) by mx.google.com with ESMTPS id y6sm11146167mug.2007.10.16.08.20.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Oct 2007 08:20:48 -0700 (PDT) Subject: Pattern-matching destructors ? From: David Teller To: OCaml Content-Type: text/plain Date: Tue, 16 Oct 2007 17:20:45 +0200 Message-Id: <1192548046.6061.18.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Sender: David Teller X-Miltered: at concorde with ID 4714D6D2.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; univ-orleans:01 node:01 constructors:01 ocaml:01 ocaml:01 camlp:01 univ-orleans:01 lifo:01 d'orleans:01 javascript:98 ast:02 inferred:02 laboratoire:03 static:03 identifier:04 Hi everyone, I'm currently working on static analysis of JavaScript 2. For this, I need to keep lots of informations in each node of my AST, including things such as line/column (for better error messages), unique identifier (for storing inferred information), etc. As things progress, I fear that the number of such informations is growing prohibitive and very much getting into the way of pattern-matching. However, I do remember reading on this list a discussion regarding the possibility of extending pattern-matching so as to allow matching against user-defined criteria rather than constructors -- I'm afraid I don't remember the name of these criteria, possibly "destructors" or "queries". As far as I remember this discussion, the feature was present in F# (or at least planned), but not in OCaml. Could anyone tell me if things have evolved on the OCaml side, perhaps with a little camlp4 magic ? Thanks in advance, David -- David Teller ------------------------------------------ Security of Distributed Systems ----------------------- -- http://www.univ-orleans.fr/lifo/Members/David.Teller ----- Laboratoire d'Informatique Fondamentale d'Orleans