Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Estimating the size of the ocaml community
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-04 (16:33)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Estimating the size of the ocaml community
On Fri, Feb 04, 2005 at 09:41:29AM +0000, Richard Jones wrote:
> On Fri, Feb 04, 2005 at 02:33:40AM +0000, Jon Harrop wrote:
> > 5. More pattern matching: [|1; 2; ...|] and [|...; 2; 1|]. (expressivity)
> And this pattern which could be used all the time in web programming:
>  | "prefix" ^ str ->
> 8. Regular expressions in the language!

9.: Pattern matching, that *really* is functional (seems to be necessary that it works
    like it is done in logical programming languages like Prolog or similar?
    I'm not familiar with Prolog, and maybe I'm wrong here to compare with these languages,
    so I will explain more elaborated what I mean...).

    Explanation: Pattern matches are like nested if's now in OCaml. The Pattern
    that matches first in the code, will be executed!!!
    This is NOT functional, this is imperative behaviour!
    If I change the pattern-matches in the code, the program may behave
    differently (depending on the data that will be matched)!
    Maybe there should be ANOTHER kind of pattern match, that does not rely
    on "which matching pattern comes first in the code executes", leaving the
    old/current pattern matching possibilities inside the language.
    But maybe something like "lmatch" (logical match), which does not executes
    the first matching pattern in the code but executes 
    "the ONLY ONE pattern that can match" (because otherwise it should be given an
    pattern match compilation error (where "match" instead of "lmatch" only gives a warning)).

    This also means that, when a general pattern is used twice, and one of them
    uses guards ("when"-clause in a pattern match), then the other pattern does
    only match, when the guard does NOT.
    (Or if there are more than one guard, that they will be checked too, or that a
    guard may be disallowed in such a kind of match.)
    And that it does not has any effect, if one of those pattern
    comes first in the source code (before the other pattern in the code appears).
    This also means to have a more powerful pattern-check on completeness.
    (Now it is not possible to check completelym when using "when" in a pattern match.)

I hope that this would be possible to integrate into OCaml (regarding the code as well
as theoretical aspects of the type-system itself).