[Omake] [Ping Jason] Are we ready for 0.9.8?

Aleksey Nogin nogin at metaprl.org
Sat Dec 9 19:49:56 PST 2006


On 08.12.2006 19:19, Jason Hickey wrote:

> Last thing that bugs me (in the category for this release):
> 
> Should regex matches produce ValData or ValString?
> 
>     match $"a b c"
>     case $'^\(.*\)$'
>         x[] = $1
>         printvln($x)
> 
> produces
> 
>     <array "a" "b" "c">
> 
> This seems wrong to me.  I would say to change the regex matches to
> ValData uniformly (I'm too lazy now, but they all use a single function
> from Omake_env, so it is easy to change).  

Right, it's all going through the Omake_env.venv_add_match_args and
Omake_env.venv_add_match. The full diff would be:

Index: src/env/omake_env.ml
===================================================================
--- src/env/omake_env.ml        (revision 9864)
+++ src/env/omake_env.ml        (working copy)
@@ -2399,20 +2399,20 @@
    let venv, _ =
       List.fold_left (fun (venv, i) arg ->
             let v = Lm_symbol.add (string_of_int i) in
-            let venv = venv_add_var_tmp venv v (ValString arg) in
+            let venv = venv_add_var_tmp venv v (ValData arg) in
                venv, succ i) (venv, 1) args
    in
       venv

 let venv_add_match venv line args =
-   let args = List.map (fun s -> ValString s) args in
+   let args = List.map (fun s -> ValData s) args in
    let venv, _ =
       List.fold_left (fun (venv, i) arg ->
             let v = Lm_symbol.add (string_of_int i) in
             let venv = venv_add_var_tmp venv v arg in
                venv, succ i) (venv, 1) args
    in
-   let venv = venv_add_var_tmp venv zero_sym (ValString line) in
+   let venv = venv_add_var_tmp venv zero_sym (ValData line) in
    let venv = venv_add_var_tmp venv star_sym (ValArray args) in
    let venv = venv_add_var_tmp venv nf_sym   (ValInt (List.length args)) in
       venv

The first two seem like an obvious choice, but I am not sure whether
zero_sym should be ValData too.

> It needs testing, but I would prefer it.

I tried it and it does not seem to be causing any problems for the
self-build. I can also try building MetaPRL. Other than that, I do not
have any obvious things to test.

Aleksey



More information about the OMake-Devel mailing list