Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camlp4rf: can't use __LOCATION__ #5352

Closed
vicuna opened this issue Aug 31, 2011 · 3 comments
Closed

camlp4rf: can't use __LOCATION__ #5352

vicuna opened this issue Aug 31, 2011 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Aug 31, 2011

Original bug ID: 5352
Reporter: Dmitry Grebeniuk
Assigned to: @diml
Status: closed (set by @xavierleroy on 2015-12-11T18:08:00Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.12.1
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

camlp4rf does not allow to use LOCATION in macros.

$ ocamlc.opt -version
3.12.1+rc1
$ ls
lo.ml _tags
$ cat lo.ml
DEFINE W = LOCATION;
value () = ignore W;
$ cat _tags
<*> : camlp4rf, warn_A
$ ocamlbuild lo.byte

  • /somepath/ocamlc.opt -c -w A -pp camlp4rf -o lo.cmo lo.ml
    File "lo.ml", line 2, characters 18-19:
    Error: Unbound module Loc
    Command exited with code 2.
    Compilation unsuccessful after building 2 targets (0 cached) in 00:00:00.
@vicuna
Copy link
Author

vicuna commented Dec 21, 2011

Comment author: @diml

camlp4rf allows LOCATION in macros. Here is the output of "camlp4rf Io.ml":

let () = ignore (Loc.of_tuple ("Io.ml", 1, 0, 11, 1, 0, 23, false))

The problem here is just that the Loc module is not defined. You have to write:

open Camlp4.PreCast;

before using LOCATION.

@vicuna
Copy link
Author

vicuna commented Aug 22, 2012

Comment author: @bobzhang

why should use LOCATION brings dependency on the whole camlp4?

@vicuna
Copy link
Author

vicuna commented Aug 22, 2012

Comment author: @diml

It doesn't. You can write you own Loc module.

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added the camlp4 label Mar 14, 2019
@vicuna vicuna assigned ghost Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant