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

Camlp4 antiquotations #2911

Closed
vicuna opened this issue Jul 6, 2004 · 1 comment
Closed

Camlp4 antiquotations #2911

vicuna opened this issue Jul 6, 2004 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jul 6, 2004

Original bug ID: 2911
Reporter: administrator
Status: closed (set by @diml on 2016-12-07T17:27:43Z)
Resolution: open
Priority: normal
Severity: feature
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

Hello,

Ça m'a pris pas mal de temps, à coup d'essais, pour trouver comment
implémenter les deux fonctions ci-dessous, en particulier pour les
parenthèses. Le comportement ne me semble pas tout à fait intuitif
(et pas documenté, j'ai l'impression).

let call_lab f l x =
if l = "" then <:expr< $f$ $x$ >>
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr< $f$ (? $l$ : $x$) >>
else
<:expr< $f$ (~ $l$ : $x$) >>

let abstr_lab l x res =
if l = "" then <:expr< fun $lid:x$ -> $res$ >>
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr< fun ? $l$ : ( $lid:x$ ) -> $res$ >>
else
<:expr< fun ~ $l$ : $lid:x$ -> $res$ >>

Ça serait pratique de pouvoir écrire simplement:

<:expr< $f$ (~ $l$ : $lid:x$) >>
<:expr< fun (~ $l$ : $lid:x$) -> $res$ >>

et que ça marche dans les trois cas (i.e. traiter automatiquement le cas
où l est vide et celui où il commence par '?').

-- Alain

@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @diml

Camlp4 is now a separate project. Please re-open a ticket on github [1] if you are still interested in seeing the original issue fixed.

[1] https://github.com/ocaml/camlp4/issues

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