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 FoldGenerator does not generate visitors for paramatric types #5786

Closed
vicuna opened this issue Oct 12, 2012 · 5 comments
Closed

Camlp4 FoldGenerator does not generate visitors for paramatric types #5786

vicuna opened this issue Oct 12, 2012 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Oct 12, 2012

Original bug ID: 5786
Reporter: meyer
Assigned to: @bobzhang
Status: closed (set by @diml on 2016-12-07T17:27:36Z)
Resolution: open
Priority: normal
Severity: feature
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @hcarty

Bug description

type t =
    A of a item
  | B of b item
and 'a item = Item of 'a
and a = string
and b = int

Will fail to generate the visitors with cryptic message similar to:

File "ghost-location", line 1, characters 0-0:
Warning 17: the virtual method unit is not declared.
File "ghost-location", line 1, characters 0-0:
Error: This class should be virtual.
       The following methods are undefined : unit

Additional information

In order to generate the visitors Camlp4 would need to have type reflection. Simple work-around would be good enough in most cases.

@vicuna
Copy link
Author

vicuna commented Oct 12, 2012

Comment author: @bobzhang

this should be considered as a feature request, since the foldgenerator was quite ad-hoc, and was just used for bootstrapping purpose, it can only handle basic ADT, types like record type, polymorphic variants are not handled well

@vicuna
Copy link
Author

vicuna commented Oct 12, 2012

Comment author: meyer

indeed it's a feature request. I don't neglect how much work is that, and how useful to me is foldgenerator even in current state.

I suppose we want something more robust then.

I propose the Necula visitors to be close to ideal, implemented in the same way as excellent "deriving" syntax extension.

@vicuna
Copy link
Author

vicuna commented Oct 12, 2012

Comment author: meyer

I'm open to help if it's needed

@vicuna
Copy link
Author

vicuna commented Jul 28, 2013

Comment author: @bobzhang

hi, meyer, I can not reproduce your case in current trunk?

@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