Version française
Home     About     Download     Resources     Contact us    
Browse thread
Difference in Quotation Behavior for str_items Between Revised and Original Syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: echinuz echinuz <echinuz@y...>
Subject: Difference in Quotation Behavior for str_items Between Revised and Original Syntax
Hi,
      Consider the following two programs:

----------------------------------------------------------
$ cat junk.ml 
let _=fun x ->
    match x with
    | <:str_item< $exp:e$ >> -> ()
    | _ -> ()
;;

$ camlp4of ./junk.ml 
fun x ->
  match x with
  | Ast.StSem (_, (Ast.StExp (_, e)), (Ast.StNil _)) -> ()
  | _ -> ()
----------------------------------------------------------

and

----------------------------------------------------------
$ cat junk_r.ml 
value _=fun x ->
    match x with
    [ <:str_item< $exp:e$ >> -> ()
    | _ -> ()]
;

$ camlp4rf ./junk_r.ml 
let _ x = match x with | Ast.StExp (_, e) -> () | _ -> ()
----------------------------------------------------------

Why does the second program expand to Ast.StExp while the first expands to Ast.StSem?  I would like, and expect, the first case to expand to Ast.StExp and not Ast.StSem.

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.