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.3 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id C442FBB84 for ; Mon, 12 Jan 2009 18:00:53 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.37,253,1231110000"; d="scan'208";a="19488295" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 12 Jan 2009 18:00:53 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id n0CH0re0000513 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 12 Jan 2009 18:00:53 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAFcGa0lPrU4G/2dsb2JhbADTToVv X-IronPort-AV: E=Sophos;i="4.37,253,1231110000"; d="scan'208";a="21377556" Received: from oak.tepkom.ru ([79.173.78.6]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 12 Jan 2009 18:00:27 +0100 Received: from localhost (localhost [127.0.0.1]) by oak.tepkom.ru (Postfix) with ESMTP id 6F21B2FD1EF for ; Mon, 12 Jan 2009 20:00:25 +0300 (MSK) X-Virus-Scanned: amavisd-new 2.6.1 (20080629) at tepkom.ru Received: from oak.tepkom.ru ([127.0.0.1]) by localhost (oak.tepkom.ru [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nX26jYdtpK-m for ; Mon, 12 Jan 2009 20:00:25 +0300 (MSK) Received: from [192.168.1.4] (ppp78-37-173-158.pppoe.avangarddsl.ru [78.37.173.158]) (Authenticated sender: db) by oak.tepkom.ru (Postfix) with ESMTP id 80EFFF6B55 for ; Mon, 12 Jan 2009 20:00:24 +0300 (MSK) Message-ID: <496B770B.4040205@tepkom.ru> Date: Mon, 12 Jan 2009 19:59:55 +0300 From: Dmitri Boulytchev User-Agent: Thunderbird 2.0.0.17 (X11/20080929) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Regular expression matching against OCaml streams. References: <496B3EE9.3020001@tepkom.ru> <496B54DF.7080303@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 496B7745.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 lexing:01 regex:01 terminate:01 terminate:01 caml-list:01 data:02 expression:02 structures:02 match:02 match:02 tepkom:02 string:02 reproduce:03 >> I don't know of any libraries for this purpose. I will warn anyone >> making one that it's easy for simple regex matching to evaluate the >> whole stream, and then fail to match. >> > > Or worse, never terminate. E.g., > > stream_match "a*b" (Stream.from (fun _ -> Some 'a')) > I do not see the problem in either case. If you has to match a long string you must be ready to fail. And if you are dealing with infinite data structures you must be ready not to terminate. At least these arguments did not prevent OCaml developers from implementing neither Stream nor, for example, Lexing.from_function, which definitely may be used to reproduce these malicious cases :) Best regards, DB.