caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* polymorphic variants and camlp4
@ 2007-02-12  3:32 Pietro Abate
  2007-02-12  4:01 ` [Caml-list] " Martin Jambon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Pietro Abate @ 2007-02-12  3:32 UTC (permalink / raw)
  To: ocaml ml

Hi all,

What is the syntax to use polymorphic variants with camlp4 ?

<:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>
doesn't work as expected...

While expanding quotation "str_item":
Parse error: '=' or '>' or '<' or [a_list] or [constructor_declaration]
  expected after '[' (in [type])
Uncaught exception: Pcaml.Qerror("str_item", 1, _)

When is the new version of camlp4/3.10 due ?
(this month, next month, next year) ?

thanks :)
p

-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] polymorphic variants and camlp4
  2007-02-12  3:32 polymorphic variants and camlp4 Pietro Abate
@ 2007-02-12  4:01 ` Martin Jambon
  2007-02-12  4:12 ` Pietro Abate
  2007-02-12 10:54 ` Nicolas Pouillard
  2 siblings, 0 replies; 5+ messages in thread
From: Martin Jambon @ 2007-02-12  4:01 UTC (permalink / raw)
  To: Pietro Abate; +Cc: ocaml ml

On Mon, 12 Feb 2007, Pietro Abate wrote:

> Hi all,
>
> What is the syntax to use polymorphic variants with camlp4 ?
>
> <:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>
> doesn't work as expected...
>
> While expanding quotation "str_item":
> Parse error: '=' or '>' or '<' or [a_list] or [constructor_declaration]
>  expected after '[' (in [type])
> Uncaught exception: Pcaml.Qerror("str_item", 1, _)

The syntax is:

   type a = [ = `A ]

(found it in pa_o.ml)

Martin

--
Martin Jambon
http://martin.jambon.free.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] polymorphic variants and camlp4
  2007-02-12  3:32 polymorphic variants and camlp4 Pietro Abate
  2007-02-12  4:01 ` [Caml-list] " Martin Jambon
@ 2007-02-12  4:12 ` Pietro Abate
  2007-02-12 14:29   ` Serge Aleynikov
  2007-02-12 10:54 ` Nicolas Pouillard
  2 siblings, 1 reply; 5+ messages in thread
From: Pietro Abate @ 2007-02-12  4:12 UTC (permalink / raw)
  To: caml-list, ocaml ml; +Cc: Pietro Abate

On Mon, Feb 12, 2007 at 02:32:20PM +1100, Pietro Abate wrote:
> What is the syntax to use polymorphic variants with camlp4 ?
> <:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>
> doesn't work as expected...

http://caml.inria.fr/mantis/view.php?id=3823

it seems that searching caml.inria.fr for "polymorphic variants camlp4"
and selecting the entire web site [1] does not give results from the bug
tracking system... Searching the site with google [2], return the above link
as first... It might be a good idea to add the bug tracking system as a
search option on the inria site.

[1]
http://caml.inria.fr//cgi-bin/search.en.cgi?words=polymorphic+variants+camlp4&corpus=all&mode=default&page=1&number=10

[2]
http://www.google.com/custom?sa=Google+Search&cof=GALT%3A%23CC6666%3BGL%3A0%3BVLC%3A%236666FF%3BAH%3Acenter%3BBGC%3Awhite%3BLH%3A60%3BLC%3A%236666FF%3BL%3Ahttp%3A%2F%2Frivesaltes.inria.fr%2Fpub%2Flogos%2Fthe-caml-language.468x60.gif%3BALC%3A%236666FF%3BLW%3A468%3BT%3Ablack%3BGIMP%3A%23CC6666%3BAWFID%3Ae31c4f7be5771b9d%3B&domains=caml.inria.fr&sitesearch=caml.inria.fr&q=polymorphic+variants+camlp4

> When is the new version of camlp4/3.10 due ?
> (this month, next month, next year) ?


-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] polymorphic variants and camlp4
  2007-02-12  3:32 polymorphic variants and camlp4 Pietro Abate
  2007-02-12  4:01 ` [Caml-list] " Martin Jambon
  2007-02-12  4:12 ` Pietro Abate
@ 2007-02-12 10:54 ` Nicolas Pouillard
  2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Pouillard @ 2007-02-12 10:54 UTC (permalink / raw)
  To: Pietro Abate, ocaml ml

On 2/12/07, Pietro Abate <Pietro.Abate@anu.edu.au> wrote:
> Hi all,
>
> What is the syntax to use polymorphic variants with camlp4 ?

It depends what you mean by "with camlp4", but I suppose you mean
"what is the revised syntax for polymorphic variants ?".

> <:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>

<:str_item< type a = A >> is not really ok neither

try <:str_item< type a = A | B >> to see that's not ok, the grammar
just accept it as an alias.

The syntax for classic variants is <:str_item< type a = [ A | B of int
and int | C of (int * int) ] >>

For polymorphic ones it's <:str_item< type a = [ = A | B ] >>

> doesn't work as expected...

Yes but you expected the original syntax for types declaration.

-- 
Nicolas Pouillard


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] polymorphic variants and camlp4
  2007-02-12  4:12 ` Pietro Abate
@ 2007-02-12 14:29   ` Serge Aleynikov
  0 siblings, 0 replies; 5+ messages in thread
From: Serge Aleynikov @ 2007-02-12 14:29 UTC (permalink / raw)
  To: Pietro Abate, caml-list, ocaml ml

If you are unsure how to translate some standard syntax to revised use 
the following tool:

camlp4o pr_r.cmo standard_syntax_file.ml

For the question below add "=" after the opening square bracket:

type a = [= `A ];

Serge

Pietro Abate wrote:
> On Mon, Feb 12, 2007 at 02:32:20PM +1100, Pietro Abate wrote:
>> What is the syntax to use polymorphic variants with camlp4 ?
>> <:str_item< type a = A >> is ok, but <:str_item< type a = [ `A ] >>
>> doesn't work as expected...
> 
> http://caml.inria.fr/mantis/view.php?id=3823
> 
> it seems that searching caml.inria.fr for "polymorphic variants camlp4"
> and selecting the entire web site [1] does not give results from the bug
> tracking system... Searching the site with google [2], return the above link
> as first... It might be a good idea to add the bug tracking system as a
> search option on the inria site.
> 
> [1]
> http://caml.inria.fr//cgi-bin/search.en.cgi?words=polymorphic+variants+camlp4&corpus=all&mode=default&page=1&number=10
> 
> [2]
> http://www.google.com/custom?sa=Google+Search&cof=GALT%3A%23CC6666%3BGL%3A0%3BVLC%3A%236666FF%3BAH%3Acenter%3BBGC%3Awhite%3BLH%3A60%3BLC%3A%236666FF%3BL%3Ahttp%3A%2F%2Frivesaltes.inria.fr%2Fpub%2Flogos%2Fthe-caml-language.468x60.gif%3BALC%3A%236666FF%3BLW%3A468%3BT%3Ablack%3BGIMP%3A%23CC6666%3BAWFID%3Ae31c4f7be5771b9d%3B&domains=caml.inria.fr&sitesearch=caml.inria.fr&q=polymorphic+variants+camlp4
> 
>> When is the new version of camlp4/3.10 due ?
>> (this month, next month, next year) ?
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-02-12 14:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12  3:32 polymorphic variants and camlp4 Pietro Abate
2007-02-12  4:01 ` [Caml-list] " Martin Jambon
2007-02-12  4:12 ` Pietro Abate
2007-02-12 14:29   ` Serge Aleynikov
2007-02-12 10:54 ` Nicolas Pouillard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).