Version française
Home     About     Download     Resources     Contact us    
Browse thread
Regular expression matching against OCaml streams.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitri Boulytchev <db@t...>
Subject: Re: [Caml-list] Re: Regular expression matching against OCaml streams.

>> 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.