| Anonymous | Login | Signup for a new account | 2013-05-19 05:34 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004452 | OCaml | Camlp4 | public | 2007-11-19 00:26 | 2012-09-15 11:23 | ||||||
| Reporter | eaubin | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | feedback | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.10.0 | ||||||||||
| Target Version | 4.01.0+dev | Fixed in Version | |||||||||
| Summary | 0004452: print_implem loops printing record contents | ||||||||||
| Description | Camlp4.PreCast.Printers.OCaml.print_implem loops printing module rec b : sig type record = { key : int; f1 : f1.record; f2 : f2.record; (((((((((((((((((((((((((((((((((((((((((((... I'm probably doing something wrong creating the list of fields. How should this be done? Thanks | ||||||||||
| Additional Information | open Camlp4.PreCast let _loc = Loc.mk "?" let base base fields ty = let fields = List.fold_right (fun field acc -> let c = <:ctyp< $lid:field$ : $uid:field$.record >> in <:ctyp< $c$ ; $acc$ >>) fields <:ctyp< >> in <:module_binding< $uid:base$ : sig type record = { key : $ty$; $fields$ } end = struct type record = { key : $ty$; $fields$ } end >> let _ = let b = base "b" ["f1"; "f2"] <:ctyp< int >> in Camlp4.PreCast.Printers.OCaml.print_implem <:str_item< module rec $b$ >> | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0004325) ertai (developer) 2007-11-19 11:35 |
You should use CleanAst to remove useless nil nodes. module CleanAst = Camlp4.Struct.CleanAst.Make(Ast) let _ = let b = base "b" ["f1"; "f2"] <:ctyp< int >> in Camlp4.PreCast.Printers.OCaml.print_implem ((new CleanAst.clean_ast)#str_item <:str_item< module rec $b$ >>) However I don't know if clean ast should be called by print_implem. I've not done it since I don't want it to be called too often since it costs. For now it's called in the main of camlp4 before printing (camlp4/Camlp4Bin.ml). |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-11-19 00:26 | eaubin | New Issue | |
| 2007-11-19 11:35 | ertai | Note Added: 0004325 | |
| 2007-11-19 11:36 | ertai | Assigned To | => ertai |
| 2007-11-19 11:36 | ertai | Status | new => feedback |
| 2012-07-11 16:01 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-12 11:28 | doligez | Assigned To | ertai => |
| 2012-07-31 13:37 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-15 11:23 | doligez | Target Version | 4.00.1+dev => 4.01.0+dev |
| Copyright © 2000 - 2011 MantisBT Group |