Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005716OCamlCamlp4public2012-08-03 14:272014-09-04 00:25
Reporterhongboz 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionundecidedFixed in Version 
Summary0005716: directive 'remove_directory' was not supported in camlp4
Description>camlp4o -str '#remove_directory "ahah"' -printer o
File "/var/folders/ty/p2nh7m4x55977ghj1zq2z1qm0000gn/T/from_string0eee06.ml", line 1, characters 0-24:
Parse error: bad directive

>camlp4o -v
Camlp4 version 4.01.0+dev6_2012-07-30
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007886)
lefessan (developer)
2012-08-03 15:00

What were you expecting ?

Directives are only usable from the toplevel, and they work for me:


ocaml -I +camlp4
        OCaml version 4.00.0

# #load "dynlink.cma";;
# #load "camlp4o.cma";;
    Camlp4 Parsing version 4.00.0

# #remove_directory "ahah";;
#
(0007887)
hongboz (developer)
2012-08-03 15:19

I think camlp4 should accept it as valid input. it's inconsistent with other directives,
e.g
camlp4o -str '#directory "haha"' -printer o
is ok

My suggestions: emit warnings for both cases.
Can you explain a bit why toplevel accept it, did they not share the same parser? Many thanks
(0007888)
hongboz (developer)
2012-08-03 15:21

actually directives are also used in sources.
like #load; #default_quotaion ...
(0007889)
lefessan (developer)
2012-08-03 15:33

Directives like "#load" or "#default_quotation" are camlp4 directives, while "#remove_directory" is an ocaml directive. Only camlp4 directives can be parsed directly by camlp4o (they are understood by the Camlp4Bin module, which drives most camlp4 binaries). The ones that are in the toplevel are either understood by camlp4, or sent back to the toplevel who can handle them.
(0007890)
hongboz (developer)
2012-08-03 15:42

then why directives 'directory', 'remove_directory' are handled differently?
(0007891)
gasche (developer)
2012-08-03 15:48

Note that eg. #warning_error and #load_rec are also affected by this behavior. This is a bit worrying for #load_rec as it should probably be specifically handled with DynLoader.
(0007904)
lefessan (developer)
2012-08-06 17:16

I still don't understand what is wrong. "camlp4" does not understand "ocaml" directives, except if they are the same ones as "camlp4" directives (i.e. #load, #directory). So, there are two possible reports here:
1/ all "ocaml" directives should be understood by "camlp4o", if somebody wants to preprocess a source file targetting the toplevel;
2/ a new "#remove_directory" directive (and probably #load_rec too) should be implemented also for camlp4, as they extend directives that are available on both camlp4 and ocaml.

Well, 1/ could be implemented by just discarding all directives, issuing a warning instead of an error. 2/ while #remove_directory seems easy to implement, #load_rec is not (the "ocaml" code for it already has a few bug reports...)
(0007925)
hongboz (developer)
2012-08-07 04:27

I am for the second report. Fails to parse is too strict

- Issue History
Date Modified Username Field Change
2012-08-03 14:27 hongboz New Issue
2012-08-03 15:00 lefessan Note Added: 0007886
2012-08-03 15:01 lefessan Status new => feedback
2012-08-03 15:19 hongboz Note Added: 0007887
2012-08-03 15:19 hongboz Status feedback => new
2012-08-03 15:21 hongboz Note Added: 0007888
2012-08-03 15:33 lefessan Note Added: 0007889
2012-08-03 15:42 hongboz Note Added: 0007890
2012-08-03 15:48 gasche Note Added: 0007891
2012-08-06 17:16 lefessan Note Added: 0007904
2012-08-07 04:27 hongboz Note Added: 0007925
2012-09-06 16:40 doligez Status new => acknowledged
2012-09-06 16:43 doligez Target Version => 4.00.1+dev
2012-09-27 11:54 doligez Note Added: 0008167
2012-09-27 11:54 doligez Target Version 4.00.1+dev => 4.01.0+dev
2012-09-27 11:55 doligez Note Deleted: 0008167
2013-08-19 15:39 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-08-21 11:24 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker