ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 406 forks source link

Camlp5 rewriters: how difficult it will be? #4193

Open Kakadu opened 3 years ago

Kakadu commented 3 years ago

It will be helpful for me to have this feature

I started hacking a little bit and got a few questions

1) Should I copy-paste module Preprocessing.Driver (into DriverP5) in the beginning and try to rework it for camlp5? I already did it, not sure that it was right decision 2) I can't get any subsystem for camlp5 packages in Lib.Sub_system.Register(M).get because of the map lib.sub_systems : Sub_system0.Instance.t lazy_t Sub_system_name.Map.t being empty. Any idea why that can happen? I have some difficulties understanding how general architecture for now. I hope it will be resolved in the future.

  Call stack grows up 

```
Lib.Sub_system.Register(M).get
Sub_system.Register_backed(M).written_by_user_or_scan
Sub_system.Register_backed(M).select_replaceable_backend
DriverP5.select
...
```
rgrinberg commented 3 years ago

Should I copy-paste module Preprocessing.Driver (into DriverP5) in the beginning and try to rework it for camlp5? I already did it, not sure that it was right decision

I'm not sure. Do you need a driver based mechanism where separate preprocessing steps are merged into a single library? I don't really know how camlp5 works.

I can't get any subsystem for camlp5 packages in Lib.Sub_system.Register(M).get because of the map lib.sub_systems : Sub_system0.Instance.t lazy_t Sub_system_name.Map.t being empty. Any idea why that can happen? I have some difficulties understanding how general architecture for now. I hope it will be resolved in the future.

I suggest you don't use the subsystem feature for this.There's a few reasons:

ejgallego commented 3 years ago

Before we stopped camlp5 in Coq, we could handle all calls to camlp5 with regular rules, so I don't think adding support should require any fancy feature.