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

Camlp4FoldGenerator doesn't handle well "abstract" types #5650

Closed
vicuna opened this issue Jun 15, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link

commented Jun 15, 2012

Original bug ID: 5650
Reporter: kyoDralliam
Assigned to: @bobzhang
Status: closed (set by @xavierleroy on 2015-12-11T18:21:27Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.12.1
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Tags: junior_job

Bug description

When using Camlp4FoldGenerator to create a map or fold class for a type t, you can't have not basic types without representation, for instance Num.num type.
A simple way to solve it would be for example to generate virtual method for such type and let the user have an abstract class i.e. accept

class virtual map = Camlp4MapGenerator.generated;;

(Until OCaml 4.00beta2 only the following form is accepted, without the virtual keyword)

class map = Camlp4MapGenerator.generated;;

Steps to reproduce

type t = A of in_channel

class map = Camlp4MapGenerator.generated;;

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

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 18, 2012

Comment author: @bobzhang

Hi, if you are patient, I wrote a code generation frame work FAN, which is more functional and general purpose.

https://groups.google.com/d/topic/fa.caml/jUiHYhEDIZo/discussion

@vicuna

This comment has been minimized.

Copy link
Author

commented Aug 5, 2013

Comment author: @bobzhang

Fixed in version 13973. Currently it would emit a warning for undeclared method name, which could be improved when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.